diff mbox series

[2/5] hw/mips/fuloong2e: Convert pointless error message to an assert()

Message ID 20200901104043.91383-3-f4bug@amsat.org
State New
Headers show
Series hw: Replace some impossible checks by assertions | expand

Commit Message

Philippe Mathieu-Daudé Sept. 1, 2020, 10:40 a.m. UTC
Displaying "vt82c686b_init error" doesn't give any hint about why
this call failed. As this message targets developers and not users,
replace the pointless error message by a call to assert() which
will provide more useful information.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/mips/fuloong2e.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

chen huacai Sept. 1, 2020, 11:36 a.m. UTC | #1
Reviewed-by: Huacai Chen <chenhc@lemote.com>

On Tue, Sep 1, 2020 at 6:41 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Displaying "vt82c686b_init error" doesn't give any hint about why
> this call failed. As this message targets developers and not users,
> replace the pointless error message by a call to assert() which
> will provide more useful information.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/mips/fuloong2e.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c
> index 8ca31e5162c..f28609976bf 100644
> --- a/hw/mips/fuloong2e.c
> +++ b/hw/mips/fuloong2e.c
> @@ -240,10 +240,7 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc,
>      PCIDevice *dev;
>
>      isa_bus = vt82c686b_isa_init(pci_bus, PCI_DEVFN(slot, 0));
> -    if (!isa_bus) {
> -        fprintf(stderr, "vt82c686b_init error\n");
> -        exit(1);
> -    }
> +    assert(isa_bus);
>      *p_isa_bus = isa_bus;
>      /* Interrupt controller */
>      /* The 8259 -> IP5  */
> --
> 2.26.2
>
>
Richard Henderson Sept. 1, 2020, 5:49 p.m. UTC | #2
On 9/1/20 3:40 AM, Philippe Mathieu-Daudé wrote:
> Displaying "vt82c686b_init error" doesn't give any hint about why
> this call failed. As this message targets developers and not users,
> replace the pointless error message by a call to assert() which
> will provide more useful information.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/mips/fuloong2e.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
Laurent Vivier Sept. 9, 2020, 1:23 p.m. UTC | #3
Le 01/09/2020 à 12:40, Philippe Mathieu-Daudé a écrit :
> Displaying "vt82c686b_init error" doesn't give any hint about why
> this call failed. As this message targets developers and not users,
> replace the pointless error message by a call to assert() which
> will provide more useful information.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/mips/fuloong2e.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c
> index 8ca31e5162c..f28609976bf 100644
> --- a/hw/mips/fuloong2e.c
> +++ b/hw/mips/fuloong2e.c
> @@ -240,10 +240,7 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc,
>      PCIDevice *dev;
>  
>      isa_bus = vt82c686b_isa_init(pci_bus, PCI_DEVFN(slot, 0));
> -    if (!isa_bus) {
> -        fprintf(stderr, "vt82c686b_init error\n");
> -        exit(1);
> -    }
> +    assert(isa_bus);
>      *p_isa_bus = isa_bus;
>      /* Interrupt controller */
>      /* The 8259 -> IP5  */
> 

Applied to my trivial-patches branch.

Thanks,
Laurent
diff mbox series

Patch

diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c
index 8ca31e5162c..f28609976bf 100644
--- a/hw/mips/fuloong2e.c
+++ b/hw/mips/fuloong2e.c
@@ -240,10 +240,7 @@  static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc,
     PCIDevice *dev;
 
     isa_bus = vt82c686b_isa_init(pci_bus, PCI_DEVFN(slot, 0));
-    if (!isa_bus) {
-        fprintf(stderr, "vt82c686b_init error\n");
-        exit(1);
-    }
+    assert(isa_bus);
     *p_isa_bus = isa_bus;
     /* Interrupt controller */
     /* The 8259 -> IP5  */