Skip to contentSkip to conversation

iommu: Fix return code in iommu_group_alloc_default_domain()

PATCH Superseded Jason Gunthorpe 2 participants 3 messages Oct 4, 2023 IOMMU

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu: Fix return code in iommu_group_alloc_default_domain()

This function returns NULL on errors, not ERR_PTR.

Fixes 1c68cbc64fe6 ("iommu: Add IOMMU_DOMAIN_PLATFORM")
---
 drivers/iommu/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/iommu.c +1 -1
index 13b911e4323d06..f9f315d58a3a14 100644
@@ -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

Signature · 1 line
2.42.0
#1 lore raw
Quoted 15 lines · Jason Gunthorpe

This function returns NULL on errors, not ERR_PTR.

Fixes 1c68cbc64fe6 ("iommu: Add IOMMU_DOMAIN_PLATFORM")
---
 drivers/iommu/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/iommu.c +0 -0
index 13b911e4323d06..f9f315d58a3a14 100644

drivers/iommu/iommu.c iommu_group_alloc_default_domain(struct iommu_group *group, int req_type) · line 1790

Quoted 5 lines
drivers/iommu/iommu.c +1 -1
@@ -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

#2 lore raw
Quoted 11 lines · Dan Carpenter
Quoted 10 lines · Jason Gunthorpe

This function returns NULL on errors, not ERR_PTR.

Fixes 1c68cbc64fe6 ("iommu: Add IOMMU_DOMAIN_PLATFORM")
---
 drivers/iommu/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

drivers/iommu/iommu.c iommu_group_alloc_default_domain(struct iommu_group *group, int req_type) · line 1790

Quoted 10 lines
drivers/iommu/iommu.c +1 -1
index 13b911e4323d06..f9f315d58a3a14 100644
@@ -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