summaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2017-06-28 12:52:48 +0200
committerJoerg Roedel <jroedel@suse.de>2017-06-28 13:29:46 +0200
commit72dcac633475a5b331cf21f3525467d0e123395a (patch)
treeef6aa57bb06464b46957fa6bb218964906495c91 /drivers/iommu
parentiommu/omap: Return ERR_PTR in device_group call-back (diff)
downloadlinux-72dcac633475a5b331cf21f3525467d0e123395a.tar.xz
linux-72dcac633475a5b331cf21f3525467d0e123395a.zip
iommu: Warn once when device_group callback returns NULL
This callback should never return NULL. Print a warning if that happens so that we notice and can fix it. Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/iommu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index de09e1e35830..3f6ea160afed 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1010,6 +1010,9 @@ struct iommu_group *iommu_group_get_for_dev(struct device *dev)
if (ops && ops->device_group)
group = ops->device_group(dev);
+ if (WARN_ON_ONCE(group == NULL))
+ return ERR_PTR(-EINVAL);
+
if (IS_ERR(group))
return group;