[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] hw/arm/boot: Report error msg if loading elf/dtb failed
From: |
Peter Maydell |
Subject: |
Re: [PATCH] hw/arm/boot: Report error msg if loading elf/dtb failed |
Date: |
Fri, 30 Aug 2024 11:05:59 +0100 |
On Fri, 30 Aug 2024 at 08:24, Changbin Du <changbin.du@huawei.com> wrote:
>
> Print errors before exit. Do not exit silently.
>
> Signed-off-by: Changbin Du <changbin.du@huawei.com>
> ---
> hw/arm/boot.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/hw/arm/boot.c b/hw/arm/boot.c
> index d480a7da02cf..17c01f299831 100644
> --- a/hw/arm/boot.c
> +++ b/hw/arm/boot.c
> @@ -839,6 +839,7 @@ 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("could not load elf '%s'", info->kernel_filename);
> exit(1);
I agree we should print a message here.
> }
>
> @@ -1322,6 +1323,7 @@ void arm_load_kernel(ARMCPU *cpu, MachineState *ms,
> struct arm_boot_info *info)
> */
> if (!info->skip_dtb_autoload && have_dtb(info)) {
> if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as, ms) <
> 0) {
> + error_report("could not load dtb '%s'", info->dtb_filename);
> exit(1);
But for this case, arm_load_dtb() should be printing the error
message itself (which lets it be more precise about what went
wrong). Is there a code path where it fails to print an error?
thanks
-- PMM