Nico Huber submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved Angel Pons: Looks good to me, approved
ene_lpc.c: Move register_shutdown to the end of initialisation

A bit more details: since register_shutdown has moved a few lines
below, now ene_enter_flash_mode is called before the shutdown function
is registered. ene_enter_flash_mode can fail (at least in theory,
it has some return 1s), but its return value is not analyzed, so even if
it returns non-0, execution goes further and register_shutdown will
happen anyway.

It is a separate question whether the return value of
ene_enter_flash_mode needs to be analyzed or is it ok to ignore it,
but in this patch I plan to keep the same behaviour, and probably I
will get back to error handling later.

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

TEST=builds
BUG=b:185191942

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

diff --git a/ene_lpc.c b/ene_lpc.c
index 993ef4d..1d045b8 100644
--- a/ene_lpc.c
+++ b/ene_lpc.c
@@ -559,16 +559,15 @@
* Compal - ec_command(0x41, 0xa1) returns 43 4f 4d 50 41 4c 9c
*/

+ ene_enter_flash_mode(ctx_data);
+
+ internal_buses_supported |= BUS_LPC;
+ spi_master_ene.data = ctx_data;

if (register_shutdown(ene_leave_flash_mode, ctx_data)) {
ret = 1;
goto ene_probe_spi_flash_exit;
}
-
- ene_enter_flash_mode(ctx_data);
-
- internal_buses_supported |= BUS_LPC;
- spi_master_ene.data = ctx_data;
register_spi_master(&spi_master_ene);
msg_pdbg("%s: successfully initialized ene\n", __func__);


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

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: If89a758c91c77486adbac2779449bcd71ab8fc78
Gerrit-Change-Number: 52406
Gerrit-PatchSet: 4
Gerrit-Owner: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Victor Ding <victording@google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-CC: Sam McNally <sammc@google.com>
Gerrit-MessageType: merged