Message ID | 20231220-wip-y-moog-phytec-de-upstream_som_detection_fixes-v1-2-c24f3239b4c3@phytec.de |
---|---|
State | Superseded |
Delegated to: | Fabio Estevam |
Headers | show |
Series | This series fixes various bugs in the phytec som_detection unit. | expand |
diff --git a/board/phytec/common/imx8m_som_detection.c b/board/phytec/common/imx8m_som_detection.c index 45f5767c565..a229eae152d 100644 --- a/board/phytec/common/imx8m_som_detection.c +++ b/board/phytec/common/imx8m_som_detection.c @@ -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);
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> --- board/phytec/common/imx8m_som_detection.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)