* [PATCH -next] iommu/ipmmu-vmsa: Fix return value check in ipmmu_find_group_dma()
@ 2017-10-17 12:11 Wei Yongjun
[not found] ` <1508242282-73764-1-git-send-email-weiyongjun1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2017-10-17 12:11 UTC (permalink / raw)
To: Joerg Roedel; +Cc: Wei Yongjun, iommu, linux-kernel
In case of error, the function iommu_group_get() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.
Fixes: 3ae47292024f ("iommu/ipmmu-vmsa: Add new IOMMU_DOMAIN_DMA ops")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
drivers/iommu/ipmmu-vmsa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index af81400..00e88a8 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -871,7 +871,7 @@ static struct iommu_group *ipmmu_find_group_dma(struct device *dev)
sibling = ipmmu_find_sibling_device(dev);
if (sibling)
group = iommu_group_get(sibling);
- if (!sibling || IS_ERR(group))
+ if (!sibling || !group)
group = generic_device_group(dev);
return group;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] iommu/ipmmu-vmsa: Fix return value check in ipmmu_find_group_dma()
[not found] ` <1508242282-73764-1-git-send-email-weiyongjun1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2017-11-06 20:05 ` Alex Williamson
0 siblings, 0 replies; 2+ messages in thread
From: Alex Williamson @ 2017-11-06 20:05 UTC (permalink / raw)
To: Wei Yongjun
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
On Tue, 17 Oct 2017 12:11:22 +0000
Wei Yongjun <weiyongjun1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> wrote:
> In case of error, the function iommu_group_get() returns NULL pointer
> not ERR_PTR(). The IS_ERR() test in the return value check should be
> replaced with NULL test.
>
> Fixes: 3ae47292024f ("iommu/ipmmu-vmsa: Add new IOMMU_DOMAIN_DMA ops")
> Signed-off-by: Wei Yongjun <weiyongjun1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> ---
> drivers/iommu/ipmmu-vmsa.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
> index af81400..00e88a8 100644
> --- a/drivers/iommu/ipmmu-vmsa.c
> +++ b/drivers/iommu/ipmmu-vmsa.c
> @@ -871,7 +871,7 @@ static struct iommu_group *ipmmu_find_group_dma(struct device *dev)
> sibling = ipmmu_find_sibling_device(dev);
> if (sibling)
> group = iommu_group_get(sibling);
> - if (!sibling || IS_ERR(group))
> + if (!sibling || !group)
> group = generic_device_group(dev);
>
> return group;
Applied to iommu/ipmmu-vmsa for v4.15.
Note that Robin's patch series[1] reworks this code, removing the call
to iommu_group_get(), but it seems correct in case anyone wants to
cherry pick it for backports. Thanks,
Alex
[1]https://www.spinics.net/lists/linux-renesas-soc/msg19228.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-06 20:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-17 12:11 [PATCH -next] iommu/ipmmu-vmsa: Fix return value check in ipmmu_find_group_dma() Wei Yongjun
[not found] ` <1508242282-73764-1-git-send-email-weiyongjun1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-11-06 20:05 ` Alex Williamson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).