summaryrefslogtreecommitdiff
path: root/arch/arm/cpu
diff options
context:
space:
mode:
authorMike Looijmans <mike.looijmans@topic.nl>2024-01-30 15:26:56 +0100
committerPeng Fan <peng.fan@nxp.com>2024-02-08 10:45:32 +0800
commit121696c957d741d17125f5416d1210b11ef8afdd (patch)
treed5eba266f83c6a66207fc6f14f69b04eb52e2984 /arch/arm/cpu
parent55fc0cbbd6c973849371bb21b45981ad26847a4b (diff)
downloadu-boot-121696c957d741d17125f5416d1210b11ef8afdd.tar.gz
u-boot-121696c957d741d17125f5416d1210b11ef8afdd.tar.bz2
u-boot-121696c957d741d17125f5416d1210b11ef8afdd.zip
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 <mike.looijmans@topic.nl> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Diffstat (limited to 'arch/arm/cpu')
-rw-r--r--arch/arm/cpu/armv8/fsl-layerscape/soc.c5
1 files changed, 5 insertions, 0 deletions
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);