]> git.proxmox.com Git - qemu.git/commitdiff
ppce500_spin: Replace assert by hw_error (fixes compiler warning)
authorStefan Weil <sw@weilnetz.de>
Sat, 28 Apr 2012 15:52:31 +0000 (17:52 +0200)
committerAlexander Graf <agraf@suse.de>
Tue, 1 May 2012 19:47:01 +0000 (21:47 +0200)
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 <sw@weilnetz.de>
[agraf: use __func__]
Signed-off-by: Alexander Graf <agraf@suse.de>
hw/ppce500_spin.c

index 95a2825bbdcc307c776cfc4ff7c74c4a96e44aa9..fddf2197a9f4e82b1b1b0923d3894cbc41b06aaa 100644 (file)
@@ -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);
     default:
-        assert(0);
+        hw_error("ppce500: unexpected %s with len = %u", __func__, len);
     }
 }