From dc9de8a2b20f495696330d60a289935f36407995 Mon Sep 17 00:00:00 2001 From: Joerg Roedel Date: Thu, 20 Dec 2018 10:02:20 +0100 Subject: iommu: Check for iommu_ops == NULL in iommu_probe_device() This check needs to be there and got lost at some point during development. Add it again. Fixes: 641fb0efbff0 ('iommu/of: Don't call iommu_ops->add_device directly') Reported-by: Marek Szyprowski Reported-by: kernelci.org bot Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/iommu/iommu.c') diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index a2131751dcff..3ed4db334341 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -114,10 +114,14 @@ void iommu_device_unregister(struct iommu_device *iommu) int iommu_probe_device(struct device *dev) { const struct iommu_ops *ops = dev->bus->iommu_ops; + int ret = -EINVAL; WARN_ON(dev->iommu_group); - return ops->add_device(dev); + if (ops) + ret = ops->add_device(dev); + + return ret; } void iommu_release_device(struct device *dev) -- cgit v1.2.3-59-g8ed1b