From: Yannic Moog Date: Wed, 20 Dec 2023 08:45:34 +0000 (+0100) Subject: board: phytec: phytec_som_detection: fix eeprom_data zero check X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=71714cda3d077b9199e3bfda8cbf0a081b0a5fa9;p=u-boot.git board: phytec: phytec_som_detection: fix eeprom_data zero check In phytec_eeprom_data_init, after reading eeprom data into buffer, it is checked whether all bytes are 0x0 by iterating over chunks of the buffer. The offset, or index of the chunk, was never changed, leading to repeated comparison of only the first chunk. Use array notation and access chunk via array index to compare all chunks of the buffer. Signed-off-by: Yannic Moog --- diff --git a/board/phytec/common/phytec_som_detection.c b/board/phytec/common/phytec_som_detection.c index 5556273127..724b8e844b 100644 --- a/board/phytec/common/phytec_som_detection.c +++ b/board/phytec/common/phytec_som_detection.c @@ -83,8 +83,8 @@ int phytec_eeprom_data_init(struct phytec_eeprom_data *data, } ptr = (int *)data; - for (i = 0; i < sizeof(struct phytec_eeprom_data); i += sizeof(ptr)) - if (*ptr != 0x0) + for (i = 0; i < sizeof(struct phytec_eeprom_data); i++) + if (ptr[i] != 0x0) break; if (i == sizeof(struct phytec_eeprom_data)) {