From patchwork Tue Mar 31 16:04:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Delaunay X-Patchwork-Id: 244658 List-Id: U-Boot discussion From: patrick.delaunay at st.com (Patrick Delaunay) Date: Tue, 31 Mar 2020 18:04:28 +0200 Subject: [PATCH 11/16] board: stm32mp1: check env_get result in board_late_init In-Reply-To: <20200331180330.1.Ied6708bad5048382a57618f95d67c549aae49f42@changeid> References: <20200331180330.1.Ied6708bad5048382a57618f95d67c549aae49f42@changeid> Message-ID: <20200331180330.11.Ic051e25812481db408f2431c7962da1db1f198fb@changeid> This patch avoids crash in strcmp when the boot_device is not present in environment (this case should be never occur) Signed-off-by: Patrick Delaunay --- board/st/stm32mp1/stm32mp1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 89a088cd28..fff4cef2c2 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -753,7 +753,8 @@ int board_late_init(void) /* Check the boot-source to disable bootdelay */ boot_device = env_get("boot_device"); - if (!strcmp(boot_device, "serial") || !strcmp(boot_device, "usb")) + if (boot_device && + (!strcmp(boot_device, "serial") || !strcmp(boot_device, "usb"))) env_set("bootdelay", "0"); return 0;