iommu/s390: Fail probe for non-PCI devices
authorMatthew Rosato <mjrosato@linux.ibm.com>
Mon, 15 Aug 2022 16:20:04 +0000 (17:20 +0100)
committerJoerg Roedel <jroedel@suse.de>
Wed, 7 Sep 2022 12:25:02 +0000 (14:25 +0200)
s390-iommu only supports pci_bus_type today.

Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/8cb71ea1b24bd2622c1937bd9cfffe73b126eb56.1660572783.git.robin.murphy@arm.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/s390-iommu.c

index cd0ee89d63e0b84530182c1951008512744d5022..ac4dab6d79e2fd6a8e36ac623bb2ad138e9ba10d 100644 (file)
@@ -185,7 +185,12 @@ static void s390_iommu_detach_device(struct iommu_domain *domain,
 
 static struct iommu_device *s390_iommu_probe_device(struct device *dev)
 {
-       struct zpci_dev *zdev = to_zpci_dev(dev);
+       struct zpci_dev *zdev;
+
+       if (!dev_is_pci(dev))
+               return ERR_PTR(-ENODEV);
+
+       zdev = to_zpci_dev(dev);
 
        return &zdev->iommu_dev;
 }