
If an error is returned, leave the return arguments alone. There is no point in setting them to zero, since the caller already knows (from the error code) that they are not being returned. This makes things simpler for callers which have an existing ramdisk. Handle the -ENOPKG error code in bootm_find_images() Signed-off-by: Simon Glass <sjg@chromium.org> --- boot/bootm.c | 2 +- boot/image-board.c | 3 --- include/image.h | 4 ++-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/boot/bootm.c b/boot/bootm.c index d19268ccd84..3431652e072 100644 --- a/boot/bootm.c +++ b/boot/bootm.c @@ -546,7 +546,7 @@ int bootm_find_images(ulong img_addr, const char *conf_ramdisk, /* find ramdisk */ ret = boot_get_ramdisk(select, &images, IH_INITRD_ARCH, &images.rd_start, &images.rd_end); - if (ret) { + if (ret && ret != -ENOPKG) { puts("Ramdisk image is corrupt or invalid\n"); return 1; } diff --git a/boot/image-board.c b/boot/image-board.c index 9ce996ff9a4..a0d2a7405e1 100644 --- a/boot/image-board.c +++ b/boot/image-board.c @@ -468,9 +468,6 @@ int boot_get_ramdisk(char const *select, struct bootm_headers *images, ulong rd_data, rd_len; int ret; - *startp = 0; - *endp = 0; - /* * Look for a '-' which indicates to ignore the * ramdisk argument diff --git a/include/image.h b/include/image.h index 1dba7387d5a..673c30f25e9 100644 --- a/include/image.h +++ b/include/image.h @@ -740,8 +740,8 @@ int boot_get_fpga(struct bootm_headers *images); * @select: address or name of ramdisk to use, or NULL for default * @images: pointer to the bootm images structure * @arch: expected ramdisk architecture - * @startp: returns ramdisk start address, or 0 if none - * @endp: returns ramdisk end on success, or 0 if none + * @startp: returns ramdisk start address, on success + * @endp: returns ramdisk end on success, on success * * Return: 0 if ramdisk image was found and valid, or skipped; * -ENOPKG if ramdisk image is found but corrupted, or invalid; -- 2.43.0