qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [Qemu-devel] [PATCH] ppc: add appropriate warning mes


From: Laurent Vivier
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] ppc: add appropriate warning message for qemu_find_file() NULL return
Date: Fri, 18 Nov 2016 09:54:20 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0


On 18/11/2016 02:03, Anand J wrote:
> Add check for qemu_find_file() NULL return and throw a warning message
> can provide better visibility to the upcoming error message if any.

You should cc: email address given by ./scripts/get_maintainer.pl

> Signed-off-by: Anand J <address@hidden>
> ---
>  hw/ppc/e500.c         | 3 +++
>  hw/ppc/mac_newworld.c | 3 +++
>  hw/ppc/mac_oldworld.c | 3 +++
>  hw/ppc/pnv.c          | 3 +++
>  4 files changed, 12 insertions(+)
> 
> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> index cf8b122..1fec0f4 100644
> --- a/hw/ppc/e500.c
> +++ b/hw/ppc/e500.c
> @@ -1014,6 +1014,9 @@ void ppce500_init(MachineState *machine, PPCE500Params 
> *params)
>          }
>      }
>      filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> +    if (!filename) {
> +        fprintf(stderr, "WARNING: failed to find %s\n", bios_name);
> +    }
>  
>      bios_size = load_elf(filename, NULL, NULL, &bios_entry, &loadaddr, NULL,
>                           1, PPC_ELF_MACHINE, 0, 0);
> diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
> index 7d25106..da54436 100644
> --- a/hw/ppc/mac_newworld.c
> +++ b/hw/ppc/mac_newworld.c
> @@ -217,6 +217,9 @@ static void ppc_core99_init(MachineState *machine)
>      if (bios_name == NULL)
>          bios_name = PROM_FILENAME;
>      filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> +    if (!filename) {
> +        fprintf(stderr, "WARNING: failed to find %s\n", bios_name);
> +    }

The upcoming error message also displays bios_name.

>      memory_region_set_readonly(bios, true);
>      memory_region_add_subregion(get_system_memory(), PROM_ADDR, bios);
>  
> diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
> index 4479487..b9bca61 100644
> --- a/hw/ppc/mac_oldworld.c
> +++ b/hw/ppc/mac_oldworld.c
> @@ -145,6 +145,9 @@ static void ppc_heathrow_init(MachineState *machine)
>      if (bios_name == NULL)
>          bios_name = PROM_FILENAME;
>      filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> +    if (!filename) {
> +        fprintf(stderr, "WARNING: failed to find %s\n", bios_name);
> +    }

The upcoming error message also displays bios_name.

>      memory_region_set_readonly(bios, true);
>      memory_region_add_subregion(sysmem, PROM_ADDR, bios);
>  
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index 9df7b25..282a0d0 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -378,6 +378,9 @@ static void ppc_powernv_init(MachineState *machine)
>      }
>  
>      fw_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> +    if (!fw_filename) {
> +        fprintf(stderr, "WARNING: failed to find %s\n", bios_name);
> +    }

>      fw_size = load_image_targphys(fw_filename, FW_LOAD_ADDR, FW_MAX_SIZE);
>      if (fw_size < 0) {
> 

I think you should exit() as for fw_size < 0, as it will display then a
NULL string, or replace fw_filename by bios_name in the following message.

Thanks,
Laurent



reply via email to

[Prev in Thread] Current Thread [Next in Thread]