diff options
author | Stefan Weil <weil@mail.berlios.de> | 2011-04-03 18:22:45 +0200 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2011-04-27 16:28:09 +0200 |
commit | 6977996c10901ab6fc7b97825443a328cd00f237 (patch) | |
tree | 1490038e6c0cd947a2c64bfbec40ecdd68ffb3d2 | |
parent | be2fe2c304a01f10ad78d5b8da2ba0d8eb7098d0 (diff) | |
download | qemu-6977996c10901ab6fc7b97825443a328cd00f237.tar.gz qemu-6977996c10901ab6fc7b97825443a328cd00f237.tar.bz2 qemu-6977996c10901ab6fc7b97825443a328cd00f237.zip |
darwin-user: Remove unneeded null pointer check
cppcheck reports this error:
commpage.c:223: error: Possible null pointer dereference:
value - otherwise it is redundant to check if value is null at line 214
The null pointer check in line 214 is indeed not needed.
If value were null, the code would crash in line 223.
See do_compare_and_swap64 were for a reference.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
-rw-r--r-- | darwin-user/commpage.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/darwin-user/commpage.c b/darwin-user/commpage.c index f6aa71e058..cc29bddd95 100644 --- a/darwin-user/commpage.c +++ b/darwin-user/commpage.c @@ -211,7 +211,7 @@ void do_compare_and_swap32(void *cpu_env, int num) uint32_t *value = (uint32_t*)((CPUX86State*)cpu_env)->regs[R_ECX]; DPRINTF("commpage: compare_and_swap32(%x,new,%p)\n", old, value); - if(value && old == tswap32(*value)) + if(old == tswap32(*value)) { uint32_t new = ((CPUX86State*)cpu_env)->regs[R_EDX]; *value = tswap32(new); |