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>
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;
}
}
/* 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;
}