iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] iommu/tegra-smmu: Fix return value check in tegra_smmu_group_get()
@ 2017-12-20  3:06 Wei Yongjun
       [not found] ` <1513739169-122341-1-git-send-email-weiyongjun1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Yongjun @ 2017-12-20  3:06 UTC (permalink / raw)
  To: Hiroshi Doyu, Joerg Roedel, Thierry Reding, Jonathan Hunter
  Cc: Wei Yongjun, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

In case of error, the function iommu_group_alloc() returns ERR_PTR() and
never returns NULL. The NULL test in the return value check should be
replaced with IS_ERR().

Fixes: 7f4c9176f760 ("iommu/tegra: Allow devices to be grouped")
Signed-off-by: Wei Yongjun <weiyongjun1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
 drivers/iommu/tegra-smmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index 8885635..44d40bc 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -832,7 +832,7 @@ static struct iommu_group *tegra_smmu_group_get(struct tegra_smmu *smmu,
 	group->soc = soc;
 
 	group->group = iommu_group_alloc();
-	if (!group->group) {
+	if (IS_ERR(group->group)) {
 		devm_kfree(smmu->dev, group);
 		mutex_unlock(&smmu->lock);
 		return NULL;

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

* Re: [PATCH -next] iommu/tegra-smmu: Fix return value check in tegra_smmu_group_get()
       [not found] ` <1513739169-122341-1-git-send-email-weiyongjun1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2017-12-20 16:44   ` Alex Williamson
       [not found]     ` <20171220094400.5b95004f-1yVPhWWZRC1BDLzU/O5InQ@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Williamson @ 2017-12-20 16:44 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Hiroshi Doyu, Joerg Roedel, Thierry Reding, Jonathan Hunter,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	treding-DDmLM1+adcrQT0dZR+AlfA

On Wed, 20 Dec 2017 03:06:09 +0000
Wei Yongjun <weiyongjun1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> wrote:

> In case of error, the function iommu_group_alloc() returns ERR_PTR() and
> never returns NULL. The NULL test in the return value check should be
> replaced with IS_ERR().
> 
> Fixes: 7f4c9176f760 ("iommu/tegra: Allow devices to be grouped")
> Signed-off-by: Wei Yongjun <weiyongjun1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/iommu/tegra-smmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
> index 8885635..44d40bc 100644
> --- a/drivers/iommu/tegra-smmu.c
> +++ b/drivers/iommu/tegra-smmu.c
> @@ -832,7 +832,7 @@ static struct iommu_group *tegra_smmu_group_get(struct tegra_smmu *smmu,
>  	group->soc = soc;
>  
>  	group->group = iommu_group_alloc();
> -	if (!group->group) {
> +	if (IS_ERR(group->group)) {
>  		devm_kfree(smmu->dev, group);
>  		mutex_unlock(&smmu->lock);
>  		return NULL;

Acked-by: Alex Williamson <alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

Thierry, I assume you'll add this on top of the referenced commit.
Thanks,

Alex

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

* Re: [PATCH -next] iommu/tegra-smmu: Fix return value check in tegra_smmu_group_get()
       [not found]     ` <20171220094400.5b95004f-1yVPhWWZRC1BDLzU/O5InQ@public.gmane.org>
@ 2017-12-20 17:41       ` Thierry Reding
  0 siblings, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2017-12-20 17:41 UTC (permalink / raw)
  To: Alex Williamson
  Cc: Wei Yongjun, Hiroshi Doyu, Joerg Roedel, Jonathan Hunter,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	treding-DDmLM1+adcrQT0dZR+AlfA

[-- Attachment #1: Type: text/plain, Size: 1357 bytes --]

On Wed, Dec 20, 2017 at 09:44:00AM -0700, Alex Williamson wrote:
> On Wed, 20 Dec 2017 03:06:09 +0000
> Wei Yongjun <weiyongjun1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> wrote:
> 
> > In case of error, the function iommu_group_alloc() returns ERR_PTR() and
> > never returns NULL. The NULL test in the return value check should be
> > replaced with IS_ERR().
> > 
> > Fixes: 7f4c9176f760 ("iommu/tegra: Allow devices to be grouped")
> > Signed-off-by: Wei Yongjun <weiyongjun1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> > ---
> >  drivers/iommu/tegra-smmu.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
> > index 8885635..44d40bc 100644
> > --- a/drivers/iommu/tegra-smmu.c
> > +++ b/drivers/iommu/tegra-smmu.c
> > @@ -832,7 +832,7 @@ static struct iommu_group *tegra_smmu_group_get(struct tegra_smmu *smmu,
> >  	group->soc = soc;
> >  
> >  	group->group = iommu_group_alloc();
> > -	if (!group->group) {
> > +	if (IS_ERR(group->group)) {
> >  		devm_kfree(smmu->dev, group);
> >  		mutex_unlock(&smmu->lock);
> >  		return NULL;
> 
> Acked-by: Alex Williamson <alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> 
> Thierry, I assume you'll add this on top of the referenced commit.
> Thanks,

Applied, thanks.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2017-12-20 17:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-20  3:06 [PATCH -next] iommu/tegra-smmu: Fix return value check in tegra_smmu_group_get() Wei Yongjun
     [not found] ` <1513739169-122341-1-git-send-email-weiyongjun1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-12-20 16:44   ` Alex Williamson
     [not found]     ` <20171220094400.5b95004f-1yVPhWWZRC1BDLzU/O5InQ@public.gmane.org>
2017-12-20 17:41       ` Thierry Reding

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