From: Ye Li Date: Wed, 11 May 2022 08:26:20 +0000 (+0530) Subject: caam: Fix crash in case caam_jr_probe failed X-Git-Tag: baikal/mips/sdk5.9~3^2~48^2~26 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=96c6eb42a8028be07611e4ed99ea762b749e4c26;p=uboot.git caam: Fix crash in case caam_jr_probe failed If probing caam_jr returns failure, the variable "dev" will not be initialized, so we can't use dev->name for the error print. Otherwise it will cause crash. Signed-off-by: Ye Li Reviewed-by: Gaurav Jain --- diff --git a/arch/arm/cpu/armv7/ls102xa/cpu.c b/arch/arm/cpu/armv7/ls102xa/cpu.c index 9fe1cd9048..0b3e3b2064 100644 --- a/arch/arm/cpu/armv7/ls102xa/cpu.c +++ b/arch/arm/cpu/armv7/ls102xa/cpu.c @@ -409,7 +409,7 @@ int arch_misc_init(void) ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev); if (ret) - printf("Failed to initialize %s: %d\n", dev->name, ret); + printf("Failed to initialize caam_jr: %d\n", ret); } return 0; diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c index a71ee636af..253008a9c1 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c +++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c @@ -1648,7 +1648,7 @@ int arch_misc_init(void) ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev); if (ret) - printf("Failed to initialize %s: %d\n", dev->name, ret); + printf("Failed to initialize caam_jr: %d\n", ret); } serdes_misc_init(); diff --git a/arch/arm/mach-imx/imx8/cpu.c b/arch/arm/mach-imx/imx8/cpu.c index 0858ea5f05..936c8f865a 100644 --- a/arch/arm/mach-imx/imx8/cpu.c +++ b/arch/arm/mach-imx/imx8/cpu.c @@ -100,7 +100,7 @@ int arch_misc_init(void) ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev); if (ret) - printf("Failed to initialize %s: %d\n", dev->name, ret); + printf("Failed to initialize caam_jr: %d\n", ret); } return 0; diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c index d261a07241..59335356b5 100644 --- a/arch/arm/mach-imx/imx8m/soc.c +++ b/arch/arm/mach-imx/imx8m/soc.c @@ -1408,7 +1408,7 @@ int arch_misc_init(void) ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev); if (ret) - printf("Failed to initialize %s: %d\n", dev->name, ret); + printf("Failed to initialize caam_jr: %d\n", ret); } return 0; diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c index 2434bcfa98..67bd991989 100644 --- a/arch/arm/mach-imx/mx6/soc.c +++ b/arch/arm/mach-imx/mx6/soc.c @@ -744,7 +744,7 @@ int arch_misc_init(void) ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev); if (ret) - printf("Failed to initialize %s: %d\n", dev->name, ret); + printf("Failed to initialize caam_jr: %d\n", ret); } setup_serial_number(); return 0; diff --git a/arch/arm/mach-imx/mx7/soc.c b/arch/arm/mach-imx/mx7/soc.c index dc9ac31eb0..c672be5d5d 100644 --- a/arch/arm/mach-imx/mx7/soc.c +++ b/arch/arm/mach-imx/mx7/soc.c @@ -361,7 +361,7 @@ int arch_misc_init(void) int ret; ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev); if (ret) - printf("Failed to initialize %s: %d\n", dev->name, ret); + printf("Failed to initialize caam_jr: %d\n", ret); } return 0; diff --git a/arch/arm/mach-imx/mx7ulp/soc.c b/arch/arm/mach-imx/mx7ulp/soc.c index 08bdc0c4af..217b7c4586 100644 --- a/arch/arm/mach-imx/mx7ulp/soc.c +++ b/arch/arm/mach-imx/mx7ulp/soc.c @@ -93,7 +93,7 @@ int arch_misc_init(void) ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev); if (ret) - printf("Failed to initialize %s: %d\n", dev->name, ret); + printf("Failed to initialize caam_jr: %d\n", ret); } return 0; diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c index 16981de244..5fa4234fd0 100644 --- a/arch/powerpc/cpu/mpc85xx/cpu_init.c +++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c @@ -950,7 +950,7 @@ int arch_misc_init(void) ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev); if (ret) - printf("Failed to initialize %s: %d\n", dev->name, ret); + printf("Failed to initialize caam_jr: %d\n", ret); } return 0; diff --git a/board/freescale/imx8mm_evk/spl.c b/board/freescale/imx8mm_evk/spl.c index ae2fb73fc5..4d96324685 100644 --- a/board/freescale/imx8mm_evk/spl.c +++ b/board/freescale/imx8mm_evk/spl.c @@ -57,7 +57,7 @@ void spl_board_init(void) ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev); if (ret) - printf("Failed to initialize %s: %d\n", dev->name, ret); + printf("Failed to initialize caam_jr: %d\n", ret); } puts("Normal Boot\n"); } diff --git a/board/freescale/imx8mn_evk/spl.c b/board/freescale/imx8mn_evk/spl.c index 3d9aa56d2c..14cb51368f 100644 --- a/board/freescale/imx8mn_evk/spl.c +++ b/board/freescale/imx8mn_evk/spl.c @@ -52,7 +52,7 @@ void spl_board_init(void) if (IS_ENABLED(CONFIG_FSL_CAAM)) { ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev); if (ret) - printf("Failed to initialize %s: %d\n", dev->name, ret); + printf("Failed to initialize caam_jr: %d\n", ret); } puts("Normal Boot\n"); diff --git a/board/freescale/imx8mp_evk/spl.c b/board/freescale/imx8mp_evk/spl.c index a2732148f2..719b1f6d7d 100644 --- a/board/freescale/imx8mp_evk/spl.c +++ b/board/freescale/imx8mp_evk/spl.c @@ -43,7 +43,7 @@ void spl_board_init(void) ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev); if (ret) - printf("Failed to initialize %s: %d\n", dev->name, ret); + printf("Failed to initialize caam_jr: %d\n", ret); } /* * Set GIC clock to 500Mhz for OD VDD_SOC. Kernel driver does