boot: Update boot_get_ramdisk() return arguments

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>
This commit is contained in:
Simon Glass
2025-07-25 10:26:43 -07:00
parent 56f7aa238b
commit ba372fcc56
3 changed files with 3 additions and 6 deletions

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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;