summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2018-09-18 15:22:57 -0700
committerSascha Hauer <s.hauer@pengutronix.de>2018-09-19 09:55:42 +0200
commit37b5422784fffe2633e141b08222ac4bf5504929 (patch)
tree078aa251ed297f345b2503977696b115b10569ba /arch
parent537f6dab35f7b5e97cdaeca3081d76295644a517 (diff)
downloadbarebox-37b5422784fffe2633e141b08222ac4bf5504929.tar.gz
barebox-37b5422784fffe2633e141b08222ac4bf5504929.tar.xz
ARM: i.MX: bbu: Check retrun value of getenv()
Add code to make sure that getenv() returned correct result and bail out if it failed. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-imx/imx-bbu-internal.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c
index 697e59f12f..faa2665720 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -415,6 +415,11 @@ static int imx_bbu_internal_mmcboot_update(struct bbu_handler *handler,
return ret;
bootpart = getenv(bootpartvar);
+ if (!bootpart) {
+ pr_err("Couldn't read the value of '%s'\n", bootpartvar);
+ ret = -ENOENT;
+ goto free_bootpartvar;
+ }
if (!strcmp(bootpart, "boot0")) {
bootpart = "boot1";