summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorAlbert Schwarzkopf <a.schwarzkopf@phytec.de>2020-09-09 12:54:46 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-09-14 10:32:23 +0200
commitb5edf4f6f07b8f0f129c70e6ceaf6ed60d6a7c5f (patch)
treee135ddf87821097c4bcb0e769a74272d4257cb94 /common
parent788546fdd86c3321c6e3ffb53774ec935b3a87a7 (diff)
downloadbarebox-b5edf4f6f07b8f0f129c70e6ceaf6ed60d6a7c5f.tar.gz
barebox-b5edf4f6f07b8f0f129c70e6ceaf6ed60d6a7c5f.tar.xz
common: bootm: Add missing check of fit_open_image() return code
Check the return code of fit_open_image() inside bootm_load_initrd(). Without this check, the code works with undefined values of "initrd_size" and "initrd" should fit_open_image() fail. Signed-off-by: Albert Schwarzkopf <a.schwarzkopf@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/bootm.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/common/bootm.c b/common/bootm.c
index 5dc00e713d..60b8bf10a8 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -233,7 +233,11 @@ int bootm_load_initrd(struct image_data *data, unsigned long load_address)
ret = fit_open_image(data->os_fit, data->fit_config, "ramdisk",
&initrd, &initrd_size);
-
+ if (ret) {
+ pr_err("Cannot open ramdisk image in FIT image: %s\n",
+ strerror(-ret));
+ return ret;
+ }
data->initrd_res = request_sdram_region("initrd",
load_address,
initrd_size);