From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55325) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnRGM-0007Z7-6C for qemu-devel@nongnu.org; Thu, 22 May 2014 07:34:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WnRGD-0002j2-4P for qemu-devel@nongnu.org; Thu, 22 May 2014 07:34:18 -0400 From: Saravanakumar Date: Thu, 22 May 2014 17:03:50 +0530 Message-Id: <1400758430-32697-1-git-send-email-saravanakumar.punith@gmail.com> Subject: [Qemu-devel] [PATCH] pci: move dereferencing of root only after verifying valid root pointer. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, Saravanakumar , mst@redhat.com Move dereferencing of root only after verifying valid root pointer. Signed-off-by: Saravanakumar --- hw/pci/pci.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 22fe5ee..8d6a8d4 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -605,13 +605,13 @@ PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, const char *devaddr) int dom, bus; unsigned slot; - assert(!root->parent_dev); - if (!root) { fprintf(stderr, "No primary PCI bus\n"); return NULL; } + assert(!root->parent_dev); + if (!devaddr) { *devfnp = -1; return pci_find_bus_nr(root, 0); -- 1.7.6.5