summaryrefslogtreecommitdiffstats
path: root/nicintel_eeprom.c
diff options
context:
space:
mode:
authorAnastasia Klimchuk <aklm@chromium.org>2021-08-03 15:45:19 +1000
committerEdward O'Callaghan <quasisec@chromium.org>2021-08-25 02:23:34 +0000
commit9db8e12c169aa5a74154d9fb9993af8044afe39f (patch)
tree66f5056031aa03f6f35643e3e1536d8b888ce722 /nicintel_eeprom.c
parentcf6668b86b0978867c2385f5311894709374a11c (diff)
downloadflashrom-9db8e12c169aa5a74154d9fb9993af8044afe39f.tar.gz
flashrom-9db8e12c169aa5a74154d9fb9993af8044afe39f.tar.bz2
flashrom-9db8e12c169aa5a74154d9fb9993af8044afe39f.zip
opaque_master: Use new API to register shutdown function
This allows opaque masters to register shutdown function in opaque_master struct, which means there is no need to call register_shutdown in init function, since this call is now a part of register_opaque_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_opaque_master() return values. BUG=b:185191942 TEST=1) builds and ninja test including CB:56413 2) on ARMv7 device flashrom -p linux_mtd -V -> using linux_mtd, chip found Change-Id: Id8471a117556edcbf9694752fabe05cf4501ce70 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56825 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Diffstat (limited to 'nicintel_eeprom.c')
-rw-r--r--nicintel_eeprom.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/nicintel_eeprom.c b/nicintel_eeprom.c
index fd9025058..58870732c 100644
--- a/nicintel_eeprom.c
+++ b/nicintel_eeprom.c
@@ -446,6 +446,7 @@ static const struct opaque_master opaque_master_nicintel_ee_82580 = {
.read = nicintel_ee_read,
.write = nicintel_ee_write_82580,
.erase = nicintel_ee_erase_82580,
+ .shutdown = nicintel_ee_shutdown_82580,
};
static const struct opaque_master opaque_master_nicintel_ee_i210 = {
@@ -453,6 +454,7 @@ static const struct opaque_master opaque_master_nicintel_ee_i210 = {
.read = nicintel_ee_read,
.write = nicintel_ee_write_i210,
.erase = nicintel_ee_erase_i210,
+ .shutdown = nicintel_ee_shutdown_i210,
};
static int nicintel_ee_init(void)
@@ -493,19 +495,13 @@ static int nicintel_ee_init(void)
*eecp = eec;
}
- if (register_shutdown(nicintel_ee_shutdown_82580, eecp))
- return 1;
-
- return register_opaque_master(&opaque_master_nicintel_ee_82580, NULL);
+ return register_opaque_master(&opaque_master_nicintel_ee_82580, eecp);
} else {
nicintel_eebar = rphysmap("Intel i210 NIC w/ emulated EEPROM",
io_base_addr + 0x12000, MEMMAP_SIZE);
if (!nicintel_eebar)
return 1;
- if (register_shutdown(nicintel_ee_shutdown_i210, NULL))
- return 1;
-
return register_opaque_master(&opaque_master_nicintel_ee_i210, NULL);
}