Skip to contentSkip to conversation

hw/pl061: Remove pointless comparison of array to null

PATCH Applied Peter Maydell 2 participants 2 messages Nov 9, 2011 – Nov 11, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/pl061: Remove pointless comparison of array to null

Remove a pointless comparison of an array to null. (There is no need to check whether s->out[i] is non-null as qemu_set_irq will do that for us.) Spotted by Coverity (see bug 887883).

---
 hw/pl061.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/pl061.c +1 -1
index d13746c..cf5adbe 100644
@@ -103,7 +103,7 @@ static void pl061_update(pl061_state *s)
     s->old_data = out;
     for (i = 0; i < 8; i++) {
         mask = 1 << i;
-        if ((changed & mask) && s->out) {
+        if (changed & mask) {
             DPRINTF("Set output %d = %d\n", i, (out & mask) != 0);
             qemu_set_irq(s->out[i], (out & mask) != 0);
         }
Signature · 1 line
1.7.1
#1 lore raw
Quoted 5 lines · Peter Maydell

Remove a pointless comparison of an array to null. (There is no need to check whether s->out[i] is non-null as qemu_set_irq will do that for us.) Spotted by Coverity (see bug 887883).

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 17 lines
---
  hw/pl061.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
hw/pl061.c +1 -1
index d13746c..cf5adbe 100644
@@ -103,7 +103,7 @@ static void pl061_update(pl061_state *s)
      s->old_data = out;
      for (i = 0; i<  8; i++) {
          mask = 1<<  i;
-        if ((changed&  mask)&&  s->out) {
+        if (changed&  mask) {
              DPRINTF("Set output %d = %d\n", i, (out&  mask) != 0);
              qemu_set_irq(s->out[i], (out&  mask) != 0);
          }