Patchwork [12/23] ide: Remove unneeded null pointer check

login
register
mail settings
Submitter Kevin Wolf
Date Jan. 24, 2011, 9:10 p.m.
Message ID <1295903452-18017-13-git-send-email-kwolf@redhat.com>
Download mbox | patch
Permalink /patch/80268/
State New
Headers show

Comments

Kevin Wolf - Jan. 24, 2011, 9:10 p.m.
From: Stefan Weil <weil@mail.berlios.de>

With bm == NULL, other code in the same function would crash.

This bug was reported by cppcheck:
hw/ide/pci.c:280: error: Possible null pointer dereference: bm

Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/ide/pci.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

Patch

diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 987caff..35168cb 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -267,9 +267,7 @@  static void bmdma_irq(void *opaque, int n, int level)
         return;
     }
 
-    if (bm) {
-        bm->status |= BM_STATUS_INT;
-    }
+    bm->status |= BM_STATUS_INT;
 
     /* trigger the real irq */
     qemu_set_irq(bm->irq, level);