From: Mike Looijmans Date: Tue, 30 Jan 2024 14:26:56 +0000 (+0100) Subject: fsl-layerscape/soc.c: do not destroy bootcmd environment X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=121696c957d741d17125f5416d1210b11ef8afdd;p=u-boot.git fsl-layerscape/soc.c: do not destroy bootcmd environment When an XXX_BOOTCOMMAND isn't defined, the result is that bootcmd is set to some random memory content. Fix it so that the function does nothing in that case and leaves the bootcmd environment unmodified. Signed-off-by: Mike Looijmans Reviewed-by: Dan Carpenter --- diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c b/arch/arm/cpu/armv8/fsl-layerscape/soc.c index 3bfdc3f774..4c61d28c20 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c +++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c @@ -811,6 +811,8 @@ __weak int fsl_setenv_bootcmd(void) enum boot_src src = get_boot_src(); char bootcmd_str[MAX_BOOTCMD_SIZE]; + bootcmd_str[0] = 0; + switch (src) { #ifdef IFC_NOR_BOOTCOMMAND case BOOT_SOURCE_IFC_NOR: @@ -859,6 +861,9 @@ __weak int fsl_setenv_bootcmd(void) break; } + if (!bootcmd_str[0]) + return 0; + ret = env_set("bootcmd", bootcmd_str); if (ret) { printf("Failed to set bootcmd: ret = %d\n", ret);