Print errors before exit. Do not exit silently.
Cc: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Changbin Du <changbin.du@huawei.com>
---
v3: use load_elf_strerror() to format errno.
v2: remove msg for arm_load_dtb.
---
hw/arm/boot.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index d480a7da02cf..6c895e05cbc0 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -839,6 +839,8 @@ static ssize_t arm_load_elf(struct arm_boot_info *info, uint64_t *pentry,
1, data_swab, as);
if (ret <= 0) {
/* The header loaded but the image didn't */
+ error_report("Couldn't load elf '%s': %s",
+ info->kernel_filename, load_elf_strerror(ret));
exit(1);
}
--
2.34.1
On 3/9/24 15:39, Changbin Du wrote:
> Print errors before exit. Do not exit silently.
>
> Cc: Philippe Mathieu-Daudé <philmd@linaro.org>
> Signed-off-by: Changbin Du <changbin.du@huawei.com>
>
> ---
> v3: use load_elf_strerror() to format errno.
> v2: remove msg for arm_load_dtb.
> ---
> hw/arm/boot.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/hw/arm/boot.c b/hw/arm/boot.c
> index d480a7da02cf..6c895e05cbc0 100644
> --- a/hw/arm/boot.c
> +++ b/hw/arm/boot.c
> @@ -839,6 +839,8 @@ static ssize_t arm_load_elf(struct arm_boot_info *info, uint64_t *pentry,
> 1, data_swab, as);
> if (ret <= 0) {
> /* The header loaded but the image didn't */
> + error_report("Couldn't load elf '%s': %s",
> + info->kernel_filename, load_elf_strerror(ret));
> exit(1);
> }
>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Thanks!
On Tue, 3 Sept 2024 at 14:52, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> On 3/9/24 15:39, Changbin Du wrote:
> > Print errors before exit. Do not exit silently.
> >
> > Cc: Philippe Mathieu-Daudé <philmd@linaro.org>
> > Signed-off-by: Changbin Du <changbin.du@huawei.com>
> >
> > ---
> > v3: use load_elf_strerror() to format errno.
> > v2: remove msg for arm_load_dtb.
> > ---
> > hw/arm/boot.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/hw/arm/boot.c b/hw/arm/boot.c
> > index d480a7da02cf..6c895e05cbc0 100644
> > --- a/hw/arm/boot.c
> > +++ b/hw/arm/boot.c
> > @@ -839,6 +839,8 @@ static ssize_t arm_load_elf(struct arm_boot_info *info, uint64_t *pentry,
> > 1, data_swab, as);
> > if (ret <= 0) {
> > /* The header loaded but the image didn't */
> > + error_report("Couldn't load elf '%s': %s",
> > + info->kernel_filename, load_elf_strerror(ret));
> > exit(1);
> > }
> >
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Applied to target-arm.next, thanks.
-- PMM
© 2016 - 2026 Red Hat, Inc.