Am Freitag, dem 19.04.2024 um 08:55 -0700 schrieb Daniel Schultz: > The ptr variable is currently defined as int and sizeof > returns the size of the eeprom data struct as Byte (32 in total). > > In case the eeprom is empty, the check, if the eeprom is empty, > will most likely stop after 8 iterations because it will continue > with the stack which should contain some data. Therefore, the > init function will detect an empty EEPROM as API0 and return with > the valid flag set to True. > > Fixes: dc22188cdc8 ("board: phytec: Add common PHYTEC SoM detection") > > Signed-off-by: Daniel Schultz <d.schu...@phytec.de>
Reviewed-by: Teresa Remmet <t.rem...@phytec.de> > --- > board/phytec/common/phytec_som_detection.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/board/phytec/common/phytec_som_detection.c > b/board/phytec/common/phytec_som_detection.c > index 5a4cc9e8b02..78c173df20d 100644 > --- a/board/phytec/common/phytec_som_detection.c > +++ b/board/phytec/common/phytec_som_detection.c > @@ -53,7 +53,7 @@ int phytec_eeprom_data_init(struct > phytec_eeprom_data *data, > { > int ret, i; > unsigned int crc; > - int *ptr; > + u8 *ptr; > const unsigned int payload_size = sizeof(struct > phytec_eeprom_payload); > > if (!data) > @@ -85,7 +85,7 @@ int phytec_eeprom_data_init(struct > phytec_eeprom_data *data, > goto err; > } > > - ptr = (int *)data; > + ptr = (u8 *)data; > for (i = 0; i < payload_size; ++i) > if (ptr[i] != 0x0) > break; -- PHYTEC Messtechnik GmbH | Barcelona-Allee 1 | 55129 Mainz, Germany Geschäftsführer: Dipl.-Ing. Michael Mitezki, Dipl.-Ing. Bodo Huber, Dipl.-Ing. (FH) Markus Lickes | Handelsregister Mainz HRB 4656 | Finanzamt Mainz | St.Nr. 266500608, DE 149059855