]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board: phytec: phytec_som_detection: fix uninitialized bug
authorYannic Moog <y.moog@phytec.de>
Wed, 20 Dec 2023 08:45:36 +0000 (09:45 +0100)
committerFabio Estevam <festevam@denx.de>
Wed, 20 Dec 2023 18:04:46 +0000 (15:04 -0300)
When som_type does not match any case, it is uninitialized and the
function still tries to print the SoM info. Rather, this is an error
condition and the function should abort prematurely. Highlight this by
printing an error message and returning early.

Signed-off-by: Yannic Moog <y.moog@phytec.de>
board/phytec/common/phytec_som_detection.c

index f879702df4504f1b526b9e04aa210e33f8341abb..1b10923b62f30a244721dbf0daee02a08d5f6dfd 100644 (file)
@@ -161,7 +161,8 @@ void __maybe_unused phytec_print_som_info(struct phytec_eeprom_data *data)
                        sub_som_type2 = 2;
                        break;
                default:
-                       break;
+                       pr_err("%s: Invalid SoM type: %i", __func__, api2->som_type);
+                       return;
                };
 
                printf("SoM: %s-%03u-%s-%03u ",