intel-iommu: Fix lookup in add device
We can't assume this device exists, fall back to the bridge itself. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Tested-by: Matthew Thode <prometheanfire@gentoo.org> Cc: stable@vger.kernel.org Signed-off-by: Joerg Roedel <joro@8bytes.org>
This commit is contained in:
parent
b334b64862
commit
3da4af0aff
@ -4108,7 +4108,7 @@ static void swap_pci_ref(struct pci_dev **from, struct pci_dev *to)
|
|||||||
static int intel_iommu_add_device(struct device *dev)
|
static int intel_iommu_add_device(struct device *dev)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(dev);
|
struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
struct pci_dev *bridge, *dma_pdev;
|
struct pci_dev *bridge, *dma_pdev = NULL;
|
||||||
struct iommu_group *group;
|
struct iommu_group *group;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -4122,7 +4122,7 @@ static int intel_iommu_add_device(struct device *dev)
|
|||||||
dma_pdev = pci_get_domain_bus_and_slot(
|
dma_pdev = pci_get_domain_bus_and_slot(
|
||||||
pci_domain_nr(pdev->bus),
|
pci_domain_nr(pdev->bus),
|
||||||
bridge->subordinate->number, 0);
|
bridge->subordinate->number, 0);
|
||||||
else
|
if (!dma_pdev)
|
||||||
dma_pdev = pci_dev_get(bridge);
|
dma_pdev = pci_dev_get(bridge);
|
||||||
} else
|
} else
|
||||||
dma_pdev = pci_dev_get(pdev);
|
dma_pdev = pci_dev_get(pdev);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user