All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu: Fix return code in iommu_group_alloc_default_domain()
@ 2023-10-04 11:59 Jason Gunthorpe
  2023-10-04 12:03 ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Gunthorpe @ 2023-10-04 11:59 UTC (permalink / raw)
  To: iommu, Joerg Roedel, Robin Murphy, Will Deacon
  Cc: Lu Baolu, Dan Carpenter, Joerg Roedel, Jerry Snitselaar

This function returns NULL on errors, not ERR_PTR.

Fixes: 1c68cbc64fe6 ("iommu: Add IOMMU_DOMAIN_PLATFORM")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/8fb75157-6c81-4a9c-9992-d73d49902fa8@moroto.mountain
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/iommu/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 13b911e4323d06..f9f315d58a3a14 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1787,7 +1787,7 @@ iommu_group_alloc_default_domain(struct iommu_group *group, int req_type)
 	 */
 	if (ops->default_domain) {
 		if (req_type)
-			return -EINVAL;
+			return NULL;
 		return ops->default_domain;
 	}
 

base-commit: 2fa5936cb764a36a95f5b31c71fc6a2954336221
-- 
2.42.0


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

* Re: [PATCH] iommu: Fix return code in iommu_group_alloc_default_domain()
  2023-10-04 11:59 [PATCH] iommu: Fix return code in iommu_group_alloc_default_domain() Jason Gunthorpe
@ 2023-10-04 12:03 ` Dan Carpenter
  2023-10-04 12:06   ` Jason Gunthorpe
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2023-10-04 12:03 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: iommu, Joerg Roedel, Robin Murphy, Will Deacon, Lu Baolu,
	Joerg Roedel, Jerry Snitselaar

On Wed, Oct 04, 2023 at 08:59:43AM -0300, Jason Gunthorpe wrote:
> This function returns NULL on errors, not ERR_PTR.
> 
> Fixes: 1c68cbc64fe6 ("iommu: Add IOMMU_DOMAIN_PLATFORM")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Link: https://lore.kernel.org/r/8fb75157-6c81-4a9c-9992-d73d49902fa8@moroto.mountain
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
>  drivers/iommu/iommu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index 13b911e4323d06..f9f315d58a3a14 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -1787,7 +1787,7 @@ iommu_group_alloc_default_domain(struct iommu_group *group, int req_type)
>  	 */
>  	if (ops->default_domain) {
>  		if (req_type)
> -			return -EINVAL;
> +			return NULL;

This looks like a merge conflict?  -EINVAL is an int and NULL is a
pointer.  #strange

regards,
dan carpenter


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

* Re: [PATCH] iommu: Fix return code in iommu_group_alloc_default_domain()
  2023-10-04 12:03 ` Dan Carpenter
@ 2023-10-04 12:06   ` Jason Gunthorpe
  0 siblings, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2023-10-04 12:06 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: iommu, Joerg Roedel, Robin Murphy, Will Deacon, Lu Baolu,
	Joerg Roedel, Jerry Snitselaar

On Wed, Oct 04, 2023 at 03:03:41PM +0300, Dan Carpenter wrote:
> On Wed, Oct 04, 2023 at 08:59:43AM -0300, Jason Gunthorpe wrote:
> > This function returns NULL on errors, not ERR_PTR.
> > 
> > Fixes: 1c68cbc64fe6 ("iommu: Add IOMMU_DOMAIN_PLATFORM")
> > Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> > Link: https://lore.kernel.org/r/8fb75157-6c81-4a9c-9992-d73d49902fa8@moroto.mountain
> > Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> > ---
> >  drivers/iommu/iommu.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> > index 13b911e4323d06..f9f315d58a3a14 100644
> > --- a/drivers/iommu/iommu.c
> > +++ b/drivers/iommu/iommu.c
> > @@ -1787,7 +1787,7 @@ iommu_group_alloc_default_domain(struct iommu_group *group, int req_type)
> >  	 */
> >  	if (ops->default_domain) {
> >  		if (req_type)
> > -			return -EINVAL;
> > +			return NULL;
> 
> This looks like a merge conflict?  -EINVAL is an int and NULL is a
> pointer.  #strange

Uhh.. the power patch I was working on accidently collected half of
this change and I didn't notice :\

Thanks,
Jason

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

end of thread, other threads:[~2023-10-04 12:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-04 11:59 [PATCH] iommu: Fix return code in iommu_group_alloc_default_domain() Jason Gunthorpe
2023-10-04 12:03 ` Dan Carpenter
2023-10-04 12:06   ` Jason Gunthorpe

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.