Edward O'Callaghan submitted this change.
par_master: Use new API to register shutdown function
This allows par masters to register shutdown function in par_master
struct, which means there is no need to call register_shutdown in init
function, since this call is now a part of register_par_master.
As a consequence of using new API, this patch also fixes propagation
of register_par_master() return values.
BUG=b:185191942
TEST=builds and ninja test
Change-Id: Ief7be907f53878b4b6567b52889735e5fff64ead
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/57156
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
---
M nic3com.c
M nicrealtek.c
2 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/nic3com.c b/nic3com.c
index dd3d0cb..2af0a52 100644
--- a/nic3com.c
+++ b/nic3com.c
@@ -99,6 +99,7 @@
.chip_writew = fallback_chip_writew,
.chip_writel = fallback_chip_writel,
.chip_writen = fallback_chip_writen,
+ .shutdown = nic3com_shutdown,
};
static int nic3com_init(void)
@@ -150,13 +151,7 @@
max_rom_decode.parallel = 128 * 1024;
- if (register_shutdown(nic3com_shutdown, data)) {
- free(data);
- goto init_err_cleanup_exit;
- }
- register_par_master(&par_master_nic3com, BUS_PARALLEL, data);
-
- return 0;
+ return register_par_master(&par_master_nic3com, BUS_PARALLEL, data);
init_err_cleanup_exit:
/* 3COM 3C90xB cards need a special fixup. */
diff --git a/nicrealtek.c b/nicrealtek.c
index b8125f4..ec821b4 100644
--- a/nicrealtek.c
+++ b/nicrealtek.c
@@ -95,6 +95,7 @@
.chip_writew = fallback_chip_writew,
.chip_writel = fallback_chip_writel,
.chip_writen = fallback_chip_writen,
+ .shutdown = nicrealtek_shutdown,
};
static int nicrealtek_init(void)
@@ -138,14 +139,7 @@
data->bios_rom_addr = bios_rom_addr;
data->bios_rom_data = bios_rom_data;
- if (register_shutdown(nicrealtek_shutdown, data)) {
- free(data);
- return 1;
- }
-
- register_par_master(&par_master_nicrealtek, BUS_PARALLEL, data);
-
- return 0;
+ return register_par_master(&par_master_nicrealtek, BUS_PARALLEL, data);
}
const struct programmer_entry programmer_nicrealtek = {
To view, visit change 57156. To unsubscribe, or for help writing mail filters, visit settings.