diff options
author | Saravanakumar | 2014-05-22 13:33:50 +0200 |
---|---|---|
committer | Michael Tokarev | 2014-05-23 22:10:29 +0200 |
commit | b645000e1ac430601eddb0b435936837aea94bb4 (patch) | |
tree | 669dfb40e7deaa9628eb5db797f93fd0785eded7 /hw/pci | |
parent | jazz_led: Add missing break in switch case (diff) | |
download | qemu-b645000e1ac430601eddb0b435936837aea94bb4.tar.gz qemu-b645000e1ac430601eddb0b435936837aea94bb4.tar.xz qemu-b645000e1ac430601eddb0b435936837aea94bb4.zip |
pci: move dereferencing of root only after verifying valid root pointer
Signed-off-by: Saravanakumar <saravanakumar.punith@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'hw/pci')
-rw-r--r-- | 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 22fe5eec36..8d6a8d4e74 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); |