diff options
author | Joerg Roedel <jroedel@suse.de> | 2018-12-20 04:02:20 -0500 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2018-12-20 04:02:20 -0500 |
commit | dc9de8a2b20f495696330d60a289935f36407995 (patch) | |
tree | 8a4f3981c0cf7b3b8d60651bdc973faffef566df /drivers/iommu/iommu.c | |
parent | d2e1a003af569e912d5f115a3c20b89a19f5caa0 (diff) |
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 <m.szyprowski@samsung.com>
Reported-by: kernelci.org bot <bot@kernelci.org>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/iommu.c')
-rw-r--r-- | drivers/iommu/iommu.c | 6 |
1 files changed, 5 insertions, 1 deletions
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) | |||
114 | int iommu_probe_device(struct device *dev) | 114 | int iommu_probe_device(struct device *dev) |
115 | { | 115 | { |
116 | const struct iommu_ops *ops = dev->bus->iommu_ops; | 116 | const struct iommu_ops *ops = dev->bus->iommu_ops; |
117 | int ret = -EINVAL; | ||
117 | 118 | ||
118 | WARN_ON(dev->iommu_group); | 119 | WARN_ON(dev->iommu_group); |
119 | 120 | ||
120 | return ops->add_device(dev); | 121 | if (ops) |
122 | ret = ops->add_device(dev); | ||
123 | |||
124 | return ret; | ||
121 | } | 125 | } |
122 | 126 | ||
123 | void iommu_release_device(struct device *dev) | 127 | void iommu_release_device(struct device *dev) |