dummyflasher.c: Fix data leak in params processing error paths

This patch extracts params processing into a separate function. Now
all error paths of params processing return 1 back to init function
which frees data.

And there was just one more error path in init function where
free(data) needed to be added.

This is a follow up on commit 3b8fe0f8e907c0ba9f7c7935e950f3e1538d427f
which moves global state into spi_master data.

A good side-effect of the change is: init function becomes easier
to read.

BUG=b:185191942
TEST=ninja test

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