Do not print the useless "Reset cause: <NULL>" line when reset cause is
unavailable due to missing overriding implementation or error. On the
other hand, I always feel uncomfortable for providing - knowingly - a
NULL pointer as printf() argument for a '%s' conversion specifier.

Signed-off-by: Massimo Pegorer <[email protected]>
---
 arch/arm/mach-rockchip/cpu-info.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/cpu-info.c 
b/arch/arm/mach-rockchip/cpu-info.c
index 823a2c6b89d..79ea3e17185 100644
--- a/arch/arm/mach-rockchip/cpu-info.c
+++ b/arch/arm/mach-rockchip/cpu-info.c
@@ -55,7 +55,8 @@ int print_cpuinfo(void)
        if (rockchip_print_soc())
                printf("SoC: Rockchip %s\n", CONFIG_SYS_SOC);
 
-       printf("Reset cause: %s\n", cause);
+       if (cause)
+               printf("Reset cause: %s\n", cause);
 
        /**
         * reset_reason env is used by rk3288, due to special use case

-- 
2.34.1

Reply via email to