1
0
mirror of https://xff.cz/git/u-boot/ synced 2026-04-11 22:50:01 +02:00

board: phytec: imx8m_som_detection: fix uninitialized pointer bug

Pointer in phytec_imx8m_detect was accessed without checking it first.
Fix this by moving the pointer check in front of any accesses.

Signed-off-by: Yannic Moog <y.moog@phytec.de>
This commit is contained in:
Yannic Moog
2023-12-20 09:45:33 +01:00
committed by Fabio Estevam
parent e2be177c85
commit da37f78525

View File

@@ -28,13 +28,13 @@ int __maybe_unused phytec_imx8m_detect(struct phytec_eeprom_data *data)
char *opt;
u8 som;
if (!data)
data = &eeprom_data;
/* We can not do the check for early API revisions */
if (data->api_rev < PHYTEC_API_REV2)
return -1;
if (!data)
data = &eeprom_data;
som = data->data.data_api2.som_no;
debug("%s: som id: %u\n", __func__, som);