aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYannic Moog <y.moog@phytec.de>2023-12-20 09:45:34 +0100
committerFabio Estevam <festevam@denx.de>2023-12-20 15:04:46 -0300
commit71714cda3d077b9199e3bfda8cbf0a081b0a5fa9 (patch)
tree3f224524d8d218ebeebd74b6a87c3dcef7fdd84e
parentda37f78525dc8a87a71f9e8d61eb891ba028eaec (diff)
downloadu-boot-71714cda3d077b9199e3bfda8cbf0a081b0a5fa9.zip
u-boot-71714cda3d077b9199e3bfda8cbf0a081b0a5fa9.tar.gz
u-boot-71714cda3d077b9199e3bfda8cbf0a081b0a5fa9.tar.bz2
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 <y.moog@phytec.de>
-rw-r--r--board/phytec/common/phytec_som_detection.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/board/phytec/common/phytec_som_detection.c b/board/phytec/common/phytec_som_detection.c
index 5556273..724b8e8 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)) {