buspirate_spi.c: Separate shutdown from failed init cleanup

Shutdown function was covering two different jobs here: 1) the actual
shutdown which is run at the end of the driver's lifecycle and
2) cleanup in cases when initialisation failed. Now, shutdown is only
doing its main job (#1), and the driver itself is doing cleanup
when init fails (#2).

The good thing is that now resources are released/closed immediately
in cases when init fails (vs shutdown function which was run at some
point later), and the driver leaves clean space after itself if init
fails.

And very importantly this unlocks API change which plans to move
register_shutdown inside register master API, see
https://review.coreboot.org/c/flashrom/+/51761

BUG=b:185191942
TEST=builds

Change-Id: I04d57e2552d23a1a4a906c68539f0ccefc13e8a0
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/52877
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
1 file changed
tree: 48f493b249822ed89147d8d24a155c0da3ad8cf2
  1. .gitattributes
  2. .gitignore
  3. 82802ab.c
  4. COPYING
  5. Documentation/
  6. Doxyfile
  7. Makefile
  8. README
  9. amd_imc.c
  10. archtest.c
  11. at45db.c
  12. atahpt.c
  13. atapromise.c
  14. atavia.c
  15. bitbang_spi.c
  16. board_enable.c
  17. buspirate_spi.c
  18. cbtable.c
  19. ch341a_spi.c
  20. chipdrivers.h
  21. chipset_enable.c
  22. cli_classic.c
  23. cli_common.c
  24. cli_output.c
  25. coreboot_tables.h
  26. custom_baud.c
  27. custom_baud.h
  28. dediprog.c
  29. developerbox_spi.c
  30. digilent_spi.c
  31. dmi.c
  32. drkaiser.c
  33. dummyflasher.c
  34. edi.c
  35. edi.h
  36. en29lv640b.c
  37. endiantest.c
  38. ene.h
  39. ene_lpc.c
  40. flash.h
  41. flashchips.c
  42. flashchips.h
  43. flashrom.8.tmpl
  44. flashrom.c
  45. fmap.c
  46. fmap.h
  47. ft2232_spi.c
  48. gfxnvidia.c
  49. helpers.c
  50. hwaccess.c
  51. hwaccess.h
  52. hwaccess_x86_io.h
  53. hwaccess_x86_io_unittest.h
  54. i2c_helper.h
  55. i2c_helper_linux.c
  56. ich_descriptors.c
  57. ich_descriptors.h
  58. ichspi.c
  59. internal.c
  60. it8212.c
  61. it85spi.c
  62. it87spi.c
  63. jedec.c
  64. jlink_spi.c
  65. layout.c
  66. layout.h
  67. libflashrom.c
  68. libflashrom.h
  69. libflashrom.map
  70. linux_mtd.c
  71. linux_spi.c
  72. lspcon_i2c_spi.c
  73. mcp6x_spi.c
  74. mec1308.c
  75. meson.build
  76. meson_options.txt
  77. mstarddc_spi.c
  78. ni845x_spi.c
  79. nic3com.c
  80. nicintel.c
  81. nicintel_eeprom.c
  82. nicintel_spi.c
  83. nicnatsemi.c
  84. nicrealtek.c
  85. ogp_spi.c
  86. opaque.c
  87. os.h
  88. pcidev.c
  89. physmap.c
  90. pickit2_spi.c
  91. platform.h
  92. pony_spi.c
  93. print.c
  94. print_wiki.c
  95. processor_enable.c
  96. programmer.c
  97. programmer.h
  98. programmer_table.c
  99. raiden_debug_spi.c
  100. rayer_spi.c
  101. realtek_mst_i2c_spi.c
  102. s25f.c
  103. satamv.c
  104. satasii.c
  105. sb600spi.c
  106. serial.c
  107. serprog.c
  108. serprog.h
  109. sfdp.c
  110. spi.c
  111. spi.h
  112. spi25.c
  113. spi25_statusreg.c
  114. spi95.c
  115. sst28sf040.c
  116. sst49lfxxxc.c
  117. sst_fwhub.c
  118. stlinkv3_spi.c
  119. stm50.c
  120. subprojects/
  121. test_build.sh
  122. tests/
  123. udelay.c
  124. unittest_env.h
  125. usb_device.c
  126. usb_device.h
  127. usbblaster_spi.c
  128. usbdev.c
  129. util/
  130. w29ee011.c
  131. w39.c
  132. wbsio_spi.c
  133. writeprotect.c
  134. writeprotect.h