mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-16 21:28:33 +03:00
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
This commit is contained in:
committed by
Harald Welte
parent
37e7861c4d
commit
c428516efa
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user