diff mbox series

iommu/arm-smmu-v3: Fix a NULL vs IS_ERR() check

Message ID 9208cd0d-8105-40df-93e9-bdcdf0d55eec@stanley.mountain (mailing list archive)
State New, archived
Headers show
Series iommu/arm-smmu-v3: Fix a NULL vs IS_ERR() check | expand

Commit Message

Dan Carpenter Aug. 15, 2024, 11:25 a.m. UTC
The arm_smmu_domain_alloc() function returns error pointers on error.  It
doesn't return NULL.  Update the error checking to match.

Fixes: 52acd7d8a413 ("iommu/arm-smmu-v3: Add support for domain_alloc_user fn")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jason Gunthorpe Aug. 15, 2024, 12:06 p.m. UTC | #1
On Thu, Aug 15, 2024 at 02:25:00PM +0300, Dan Carpenter wrote:
> The arm_smmu_domain_alloc() function returns error pointers on error.  It
> doesn't return NULL.  Update the error checking to match.
> 
> Fixes: 52acd7d8a413 ("iommu/arm-smmu-v3: Add support for domain_alloc_user fn")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Yeah, looks like this was missed during a rebase

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason
Shameerali Kolothum Thodi Aug. 15, 2024, 1:03 p.m. UTC | #2
> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@linaro.org>
> Sent: Thursday, August 15, 2024 12:25 PM
> To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
> Cc: Will Deacon <will@kernel.org>; Robin Murphy
> <robin.murphy@arm.com>; Joerg Roedel <joro@8bytes.org>; Jason
> Gunthorpe <jgg@ziepe.ca>; Nicolin Chen <nicolinc@nvidia.com>; Michael
> Shavit <mshavit@google.com>; Mostafa Saleh <smostafa@google.com>; Lu
> Baolu <baolu.lu@linux.intel.com>; Kevin Tian <kevin.tian@intel.com>; linux-
> arm-kernel@lists.infradead.org; iommu@lists.linux.dev; linux-
> kernel@vger.kernel.org; kernel-janitors@vger.kernel.org
> Subject: [PATCH] iommu/arm-smmu-v3: Fix a NULL vs IS_ERR() check
> 
> The arm_smmu_domain_alloc() function returns error pointers on error.  It
> doesn't return NULL.  Update the error checking to match.
> 
> Fixes: 52acd7d8a413 ("iommu/arm-smmu-v3: Add support for
> domain_alloc_user fn")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>

Thanks,
Shameer
Will Deacon Aug. 16, 2024, 3:15 p.m. UTC | #3
On Thu, 15 Aug 2024 14:25:00 +0300, Dan Carpenter wrote:
> The arm_smmu_domain_alloc() function returns error pointers on error.  It
> doesn't return NULL.  Update the error checking to match.
> 
> 

Applied to will (for-joerg/arm-smmu/updates), thanks!

[1/1] iommu/arm-smmu-v3: Fix a NULL vs IS_ERR() check
      https://git.kernel.org/will/c/af048ec9c051

Cheers,
diff mbox series

Patch

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 9bc50bded5af..cf21d7d2e737 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -3062,8 +3062,8 @@  arm_smmu_domain_alloc_user(struct device *dev, u32 flags,
 		return ERR_PTR(-EOPNOTSUPP);
 
 	smmu_domain = arm_smmu_domain_alloc();
-	if (!smmu_domain)
-		return ERR_PTR(-ENOMEM);
+	if (IS_ERR(smmu_domain))
+		return ERR_CAST(smmu_domain);
 
 	smmu_domain->domain.type = IOMMU_DOMAIN_UNMANAGED;
 	smmu_domain->domain.ops = arm_smmu_ops.default_domain_ops;