diff mbox series

[v3] hw/arm/boot: Report error msg if loading elf/dtb failed

Message ID 20240903133940.3447430-1-changbin.du@huawei.com (mailing list archive)
State New, archived
Headers show
Series [v3] hw/arm/boot: Report error msg if loading elf/dtb failed | expand

Commit Message

Changbin Du Sept. 3, 2024, 1:39 p.m. UTC
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(+)

Comments

Peter Maydell Sept. 3, 2024, 4:38 p.m. UTC | #1
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
diff mbox series

Patch

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