Patchwork ppce500_spin: Replace assert by hw_error (fixes compiler warning)

login
register
mail settings
Submitter Andreas Färber
Date April 30, 2012, 3:01 p.m.
Message ID <4F9EA961.7020505@suse.de>
Download mbox | patch
Permalink /patch/155886/
State New
Headers show

Comments

Andreas Färber - April 30, 2012, 3:01 p.m.
Am 30.04.2012 10:54, schrieb Alexander Graf:
> 
> On 28.04.2012, at 17:52, Stefan Weil wrote:
> 
>> 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>
> 
> Thanks, applied to ppc-next. The patch didn't show up on patchworks btw, not sure what went wrong there.

Please consider fixing up on your branch as follows:



Andreas

Patch

diff --git a/hw/ppce500_spin.c b/hw/ppce500_spin.c
index 8522c41..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);
     default:
-        hw_error("ppce500: unexpected spin_read with len = %u", len);
+        hw_error("ppce500: unexpected %s with len = %u", __func__, len);
     }
 }