diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index b0fe7712b4d4bc153aa23964260562c470dda39a..aeccc911abb829182cbee0b82ecb4c0b49640aa2 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c @@ -152,11 +152,15 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset) static void virtfn_remove(struct pci_dev *dev, int id, int reset) { char buf[VIRTFN_ID_LEN]; + struct pci_bus *bus; struct pci_dev *virtfn; struct pci_sriov *iov = dev->sriov; - virtfn = pci_get_domain_bus_and_slot(pci_domain_nr(dev->bus), - virtfn_bus(dev, id), virtfn_devfn(dev, id)); + bus = pci_find_bus(pci_domain_nr(dev->bus), virtfn_bus(dev, id)); + if (!bus) + return; + + virtfn = pci_get_slot(bus, virtfn_devfn(dev, id)); if (!virtfn) return;