diff options
author | Yannic Moog | 2023-12-20 09:45:33 +0100 |
---|---|---|
committer | Fabio Estevam | 2023-12-20 15:04:46 -0300 |
commit | da37f78525dc8a87a71f9e8d61eb891ba028eaec (patch) | |
tree | 49ce95caf4ad2fc8482715b5281e0d7a6e7b3b07 /board/phytec | |
parent | e2be177c8511580bab3c368e8b173135471b671e (diff) |
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>
Diffstat (limited to 'board/phytec')
-rw-r--r-- | board/phytec/common/imx8m_som_detection.c | 6 |
1 files changed, 3 insertions, 3 deletions
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); |