Nico Huber submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, but someone else must approve Angel Pons: Looks good to me, approved Nikolai Artemiev: Looks good to me, but someone else must approve
raiden_debug_spi: Use new API to register shutdown function

This allows programmer to register shutdown function in spi_master
struct, which means there is no need to call register_shutdown in init
function, since this call is now a part of register_spi_master.

As a consequence of using new API, two things are happening here:
1) No resource leakage anymore in case register_shutdown() would fail,
2) Fixed propagation of register_spi_master() return values.

BUG=b:185191942
TEST=test in CB:57918
(Nikolai) tested probe/read/write with a servo micro and puff board

Change-Id: I8927224779f24d1fda088991337e54d7272775a6
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/57975
Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
M raiden_debug_spi.c
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/raiden_debug_spi.c b/raiden_debug_spi.c
index a2fddb4..3f35552 100644
--- a/raiden_debug_spi.c
+++ b/raiden_debug_spi.c
@@ -1298,6 +1298,7 @@
.read = default_spi_read,
.write_256 = default_spi_write_256,
.write_aai = default_spi_write_aai,
+ .shutdown = raiden_debug_spi_shutdown,
};

static int match_endpoint(struct libusb_endpoint_descriptor const *descriptor,
@@ -1611,10 +1612,7 @@
return SPI_GENERIC_ERROR;
}

- register_spi_master(spi_config, data);
- register_shutdown(raiden_debug_spi_shutdown, data);
-
- return 0;
+ return register_spi_master(spi_config, data);
}

const struct programmer_entry programmer_raiden_debug_spi = {

3 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one.

To view, visit change 57975. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I8927224779f24d1fda088991337e54d7272775a6
Gerrit-Change-Number: 57975
Gerrit-PatchSet: 5
Gerrit-Owner: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev@google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter@mailbox.org>
Gerrit-MessageType: merged