aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKévin Redon <kredon@sysmocom.de>2018-08-07 12:12:47 +0200
committerHarald Welte <laforge@gnumonks.org>2018-08-07 15:14:37 +0000
commitc428516efaa1ea980b762dd1a7886340aebbea38 (patch)
tree64f2e47ac8a65b326e917783f756ed8f5e1d9ccb
parent37e7861c4d232d96209defaf8ac2dbfb4d11f242 (diff)
qmod: error on EEPROM erase fail
repeating the EEPROM erase (byte write) in case of byte write failure could lead in an infinite loop. log the error an return error code instead. Change-Id: Id6f3654d877ca772ba04237da91a6e86e3f441ec
-rw-r--r--firmware/libboard/qmod/source/board_qmod.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/firmware/libboard/qmod/source/board_qmod.c b/firmware/libboard/qmod/source/board_qmod.c
index acd090f..bdc08f9 100644
--- a/firmware/libboard/qmod/source/board_qmod.c
+++ b/firmware/libboard/qmod/source/board_qmod.c
@@ -113,9 +113,11 @@ static int erase_hub_eeprom(void)
/* write the EEPROM once */
for (i = 0; i < 256; i++) {
int rc = eeprom_write_byte(0x50, i, 0xff);
- /* if the result was negative, repeat that write */
- if (rc < 0)
- i--;
+ if (rc < 0) {
+ TRACE_ERROR("Erasing EEPROM failed at byte %u: 0x%02x\n\r",
+ i, __eeprom_bin[i]);
+ return 1;
+ }
}
return 0;