All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu: Check for iommu_ops == NULL in iommu_probe_device()
@ 2018-12-20  9:08 Joerg Roedel
       [not found] ` <20181220090833.6643-1-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Joerg Roedel @ 2018-12-20  9:08 UTC (permalink / raw)
  To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA; +Cc: Joerg Roedel

From: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>

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-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Reported-by: kernelci.org bot <bot-ssFOTAMYnuFg9hUCZPvPmw@public.gmane.org>
Signed-off-by: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
---
 drivers/iommu/iommu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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)
-- 
2.13.7

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-01-16 17:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-20  9:08 [PATCH] iommu: Check for iommu_ops == NULL in iommu_probe_device() Joerg Roedel
     [not found] ` <20181220090833.6643-1-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2019-01-16 15:27   ` Auger Eric
     [not found]     ` <e1a87036-d2df-c59b-a23d-9093ba02bacd-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2019-01-16 16:33       ` Jean-Philippe Brucker
     [not found]         ` <270d1c47-0752-68c7-e5ca-d19dcd170bbc-5wv7dgnIgG8@public.gmane.org>
2019-01-16 16:43           ` Joerg Roedel
     [not found]             ` <20190116164316.GC4681-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2019-01-16 17:40               ` Auger Eric

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.