From: Vishal Chourasia Date: Fri, 24 Oct 2025 13:06:01 +0000 (+0530) Subject: hw/core/loader: Pass errp to load_image_targphys_as() X-Git-Tag: v10.2.0-rc1~41^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1b5eafee86d9bd26efcc09ad82424a85c88206f4;p=thirdparty%2Fqemu.git hw/core/loader: Pass errp to load_image_targphys_as() Pass errp to load_image_targphys_as() in generic-loader and guest-loader to capture detailed error information from the loader functions. Use error_prepend() instead of error_setg() to preserve the underlying error details while adding context about which image failed to load. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Vishal Chourasia Message-ID: <20251024130556.1942835-12-vishalc@linux.ibm.com> Signed-off-by: Philippe Mathieu-Daudé --- diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c index 6689847c33..433efb7387 100644 --- a/hw/core/generic-loader.c +++ b/hw/core/generic-loader.c @@ -149,13 +149,13 @@ static void generic_loader_realize(DeviceState *dev, Error **errp) if (size < 0 || s->force_raw) { /* Default to the maximum size being the machine's ram size */ size = load_image_targphys_as(s->file, s->addr, - current_machine->ram_size, as, NULL); + current_machine->ram_size, as, errp); } else { s->addr = entry; } if (size < 0) { - error_setg(errp, "Cannot load specified image %s", s->file); + error_prepend(errp, "Cannot load specified image %s: ", s->file); return; } } diff --git a/hw/core/guest-loader.c b/hw/core/guest-loader.c index 59f325ad9c..618455e556 100644 --- a/hw/core/guest-loader.c +++ b/hw/core/guest-loader.c @@ -101,9 +101,9 @@ static void guest_loader_realize(DeviceState *dev, Error **errp) /* Default to the maximum size being the machine's ram size */ size = load_image_targphys_as(file, s->addr, current_machine->ram_size, - NULL, NULL); + NULL, errp); if (size < 0) { - error_setg(errp, "Cannot load specified image %s", file); + error_prepend(errp, "Cannot load specified image %s: ", file); return; }