[Top][All Lists]

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

[Qemu-ppc] [PATCH 7/8] ppce500_spin: Replace assert by hw_error (fixes c

From: Alexander Graf
Subject: [Qemu-ppc] [PATCH 7/8] ppce500_spin: Replace assert by hw_error (fixes compiler warning)
Date: Tue, 1 May 2012 10:58:59 +0200

From: Stefan Weil <address@hidden>

The default case in function spin_read should never be reached,
therefore the old code used assert(0) to abort QEMU.

This does not work when QEMU is compiled with macro NDEBUG defined.
In this case (and also when the compiler does not know that assert
never returns), there is a compiler warning because of the missing
return value.

Using hw_error allows an improved error message and aborts always.

Signed-off-by: Stefan Weil <address@hidden>
[agraf: use __func__]
Signed-off-by: Alexander Graf <address@hidden>
 hw/ppce500_spin.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/ppce500_spin.c b/hw/ppce500_spin.c
index 95a2825..fddf219 100644
--- a/hw/ppce500_spin.c
+++ b/hw/ppce500_spin.c
@@ -179,7 +179,7 @@ static uint64_t spin_read(void *opaque, target_phys_addr_t 
addr, unsigned len)
     case 4:
         return ldl_p(spin_p);
-        assert(0);
+        hw_error("ppce500: unexpected %s with len = %u", __func__, len);

reply via email to

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