ppc: add appropriate warning message for qemu_find_file() NULL return
PATCH 1/1 ppc: add appropriate warning message for qemu_find_file() NULL return
Add check for qemu_find_file() NULL return and throw a warning message can provide better visibility to the upcoming error message if any.
--- 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(+)
hw/ppc/e500.c +3 -0
@@ -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 );
hw/ppc/mac_newworld.c +3 -0
@@ -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); + }memory_region_set_readonly (bios, true);memory_region_add_subregion (get_system_memory (),PROM_ADDR , bios);
hw/ppc/mac_oldworld.c +3 -0
@@ -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); + }memory_region_set_readonly (bios, true);memory_region_add_subregion (sysmem,PROM_ADDR , bios);
hw/ppc/pnv.c +3 -0
@@ -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 ) {
Signature · 1 line
2.7.4
Quoted 2 lines · Anand J
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
Quoted 27 lines
Signed-off-by Anand J <[email protected]>--- 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(+)hw/ppc/e500.c +3
-0@@ -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 );hw/ppc/mac_newworld.c +0
-0
hw/ppc/mac_newworld.c static void ppc_core99_init(MachineState *machine) · line 222
Quoted 6 lines
hw/ppc/mac_newworld.c +3
-0@@ -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.
Quoted 8 lines
hw/ppc/mac_newworld.c +0
-0memory_region_set_readonly (bios, true);memory_region_add_subregion (get_system_memory (),PROM_ADDR , bios);hw/ppc/mac_oldworld.c +0
-0
hw/ppc/mac_oldworld.c static void ppc_heathrow_init(MachineState *machine) · line 150
Quoted 6 lines
hw/ppc/mac_oldworld.c +3
-0@@ -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.
Quoted 9 lines
hw/ppc/mac_oldworld.c +0
-0memory_region_set_readonly (bios, true);memory_region_add_subregion (sysmem,PROM_ADDR , bios);hw/ppc/pnv.c +0
-0
hw/ppc/pnv.c static void ppc_powernv_init(MachineState *machine) · line 386
Quoted 9 lines
hw/ppc/pnv.c +3
-0@@ -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