mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
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é <philmd@linaro.org> Signed-off-by: Vishal Chourasia <vishalc@linux.ibm.com> Message-ID: <20251024130556.1942835-12-vishalc@linux.ibm.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
committed by
Philippe Mathieu-Daudé
parent
beded5ebd0
commit
1b5eafee86
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user