[PATCH v6 15/20] mpc83xx: gazerbeam: Update sysinfo_get error handling

Michal Suchanek msuchanek at suse.de
Wed Oct 12 21:58:04 CEST 2022


In a later patch sysinfo_get will be changed to return the device in cae
of an error. Set sysinfo to NULL on error to preserve previous behavior.

Signed-off-by: Michal Suchanek <msuchanek at suse.de>
---
 board/gdsys/mpc8308/gazerbeam.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/board/gdsys/mpc8308/gazerbeam.c b/board/gdsys/mpc8308/gazerbeam.c
index 3d4a7e57fe..ba88401f13 100644
--- a/board/gdsys/mpc8308/gazerbeam.c
+++ b/board/gdsys/mpc8308/gazerbeam.c
@@ -49,8 +49,10 @@ int board_early_init_r(void)
 	int mc = 0;
 	int con = 0;
 
-	if (sysinfo_get(&sysinfo))
+	if (sysinfo_get(&sysinfo)) {
 		puts("Could not find sysinfo information device.\n");
+		sysinfo = NULL;
+	}
 
 	/* Initialize serdes */
 	uclass_get_device_by_phandle(UCLASS_MISC, sysinfo, "serdes", &serdes);
@@ -92,8 +94,10 @@ int checksysinfo(void)
 	int mc = 0;
 	int con = 0;
 
-	if (sysinfo_get(&sysinfo))
+	if (sysinfo_get(&sysinfo)) {
 		puts("Could not find sysinfo information device.\n");
+		sysinfo = NULL;
+	}
 
 	sysinfo_get_int(sysinfo, BOARD_MULTICHANNEL, &mc);
 	sysinfo_get_int(sysinfo, BOARD_VARIANT, &con);
@@ -130,8 +134,10 @@ int last_stage_init(void)
 	struct udevice *tpm;
 	int ret;
 
-	if (sysinfo_get(&sysinfo))
+	if (sysinfo_get(&sysinfo)) {
 		puts("Could not find sysinfo information device.\n");
+		sysinfo = NULL;
+	}
 
 	if (sysinfo) {
 		int res = sysinfo_get_int(sysinfo, BOARD_HWVERSION,
-- 
2.37.3



More information about the U-Boot mailing list