s390x/pci: fix null pointer bug

We should make sure that it's not NULL firstly.

Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
This commit is contained in:
Yi Min Zhao 2016-08-05 17:00:35 +08:00 committed by Cornelia Huck
parent 51009170d8
commit 7fc0abf4cb

View File

@ -712,7 +712,7 @@ static void s390_pcihost_hot_unplug(HotplugHandler *hotplug_dev,
pci_dev = PCI_DEVICE(dev);
for (i = 0 ; i < PCI_SLOT_MAX; i++) {
if (s->pbdev[i]->pdev == pci_dev) {
if (s->pbdev[i] && s->pbdev[i]->pdev == pci_dev) {
pbdev = s->pbdev[i];
break;
}