aboutsummaryrefslogtreecommitdiffstats
path: root/nicintel_eeprom.c
diff options
context:
space:
mode:
authorAlexander Goncharov <chat@joursoir.net>2022-08-07 12:08:49 +0300
committerAnastasia Klimchuk <aklm@chromium.org>2022-08-30 10:12:35 +0000
commit0b654bb92e273e4facdca1c561556ef5e57c3513 (patch)
tree88f32349f498b5266552b133dd3c84e0a67e92c4 /nicintel_eeprom.c
parentbbf20776f8049985ea2cf143fd975178c41bc743 (diff)
downloadflashrom-0b654bb92e273e4facdca1c561556ef5e57c3513.tar.gz
flashrom-0b654bb92e273e4facdca1c561556ef5e57c3513.tar.bz2
flashrom-0b654bb92e273e4facdca1c561556ef5e57c3513.zip
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 TEST=builds Change-Id: Idb4f75fa92966a0fffd83dd0e297f5f51f6c0bd3 Signed-off-by: Alexander Goncharov <chat@joursoir.net> Ticket: https://ticket.coreboot.org/issues/391 Reviewed-on: https://review.coreboot.org/c/flashrom/+/66491 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'nicintel_eeprom.c')
-rw-r--r--nicintel_eeprom.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/nicintel_eeprom.c b/nicintel_eeprom.c
index 42e6a7bb..6827d9a2 100644
--- a/nicintel_eeprom.c
+++ b/nicintel_eeprom.c
@@ -397,8 +397,10 @@ static int nicintel_ee_erase_82580(struct flashctx *flash, unsigned int addr, un
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);
@@ -408,11 +410,13 @@ static int nicintel_ee_shutdown_i210(void *arg)
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)