nicintel_eeprom: handle errors using goto for i210's shutdown
This patch prepares the programmer to move global singleton states
into a struct.
TOPIC=register_master_api
Change-Id: Idb4f75fa92966a0fffd83dd0e297f5f51f6c0bd3
Signed-off-by: Alexander Goncharov <chat@joursoir.net>
Ticket: https://ticket.coreboot.org/issues/391
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/66491
Original-Reviewed-by: Thomas Heijligen <src@posteo.de>
Original-Reviewed-by: Felix Singer <felixsinger@posteo.net>
Original-Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Original-Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Original-Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71478
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/nicintel_eeprom.c b/nicintel_eeprom.c
index 5f9e0f9..0b20290 100644
--- a/nicintel_eeprom.c
+++ b/nicintel_eeprom.c
@@ -411,8 +411,10 @@
static int nicintel_ee_shutdown_i210(void *arg)
{
+ int ret = 0;
+
if (!done_i20_write)
- return 0;
+ goto out;
uint32_t flup = pci_mmio_readl(nicintel_eebar + EEC);
@@ -422,11 +424,13 @@
int i;
for (i = 0; i < MAX_ATTEMPTS; i++)
if (pci_mmio_readl(nicintel_eebar + EEC) & BIT(EE_FLUDONE))
- return 0;
+ goto out;
+ ret = -1;
msg_perr("Flash update failed\n");
- return -1;
+out:
+ return ret;
}
static int nicintel_ee_shutdown_82580(void *eecp)