From bdbac76046cc789ea94f6998239acc53a16aeb74 Mon Sep 17 00:00:00 2001 From: graphine27 <64922824+graphine27@users.noreply.github.com> Date: Sat, 4 Feb 2023 00:38:14 +0200 Subject: [PATCH] Update eeprom.c Signed-off-by: graphine27 <64922824+graphine27@users.noreply.github.com> --- tools/eeprom.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/eeprom.c b/tools/eeprom.c index 68ad8d065..375018ab1 100644 --- a/tools/eeprom.c +++ b/tools/eeprom.c @@ -220,7 +220,11 @@ mt76_eeprom_changes(void) buf = malloc(EEPROM_PART_SIZE); fseek(f, mtd_offset, SEEK_SET); - fread(buf, 1, EEPROM_PART_SIZE, f); + int result = fread(buf, 1, EEPROM_PART_SIZE, f); + if (!result) { + fprintf(stderr, "Cannot read from MTD device\n"); + return 1; + } for (i = 0; i < EEPROM_PART_SIZE; i++) { if (buf[i] == eeprom_data[i]) continue;