Skip to contentSkip to conversation

iommu: Delete a duplicate check in iommu_change_dev_def_domain()

PATCH Applied Zhen Lei 3 participants 3 messages May 13, 2021 – Jun 9, 2021 IOMMU

lore
Share & tools
lore

Zhen Lei

author
#0 lore raw

PATCH 1/1 iommu: Delete a duplicate check in iommu_change_dev_def_domain()

Function iommu_group_store_type() is the only caller of the static function iommu_change_dev_def_domain() and has performed "if (WARN_ON(!group))" detection before calling it. So the one here is redundant.

---
 drivers/iommu/iommu.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/iommu/iommu.c +0 -3
index 971068da67cb91d..8cdf6a1c4bfd773 100644
@@ -3059,9 +3059,6 @@ static int iommu_change_dev_def_domain(struct iommu_group *group,
 	int ret, dev_def_dom;
 	struct device *dev;
 
-	if (!group)
-		return -EINVAL;
-
 	mutex_lock(&group->mutex);
 
 	if (group->default_domain != group->domain) {
Signature · 7 lines
2.26.0.106.g9fadedd


_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines · Zhen Lei

Function iommu_group_store_type() is the only caller of the static function iommu_change_dev_def_domain() and has performed "if (WARN_ON(!group))" detection before calling it. So the one here is redundant.

---
 drivers/iommu/iommu.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/iommu/iommu.c +0 -0
index 971068da67cb91d..8cdf6a1c4bfd773 100644

drivers/iommu/iommu.c static int iommu_change_dev_def_domain(struct iommu_group *group, · line 3064

Quoted 9 lines
drivers/iommu/iommu.c +0 -3
@@ -3059,9 +3059,6 @@ static int iommu_change_dev_def_domain(struct iommu_group *group,
 	int ret, dev_def_dom;
 	struct device *dev;
 
-	if (!group)
-		return -EINVAL;
-
 	mutex_lock(&group->mutex);
 
 	if (group->default_domain != group->domain) {

Will
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

maintainer Applied
#2 lore raw
In reply to Zhen Lei
Quoted 9 lines · Zhen Lei

Function iommu_group_store_type() is the only caller of the static function iommu_change_dev_def_domain() and has performed "if (WARN_ON(!group))" detection before calling it. So the one here is redundant.

---
 drivers/iommu/iommu.c | 3 ---
 1 file changed, 3 deletions(-)

Applied, thanks.

Quoted 18 lines
drivers/iommu/iommu.c +0 -3
index 971068da67cb91d..8cdf6a1c4bfd773 100644
@@ -3059,9 +3059,6 @@ static int iommu_change_dev_def_domain(struct iommu_group *group,
 	int ret, dev_def_dom;
 	struct device *dev;
 
-	if (!group)
-		return -EINVAL;
-
 	mutex_lock(&group->mutex);
 
 	if (group->default_domain != group->domain) {
Signature · 1 line
2.26.0.106.g9fadedd

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu