Skip to contentSkip to conversation

iommu: Use right function to get group for device

PATCH Applied Lu Baolu 2 participants 2 messages May 21, 2019 – May 27, 2019 IOMMU

lore
Share & tools
lore

Lu Baolu

author
#0 lore raw

PATCH 1/1 iommu: Use right function to get group for device

The iommu_group_get_for_dev() will allocate a group for a device if it isn't in any group. This isn't the use case in iommu_request_dm_for_dev(). Let's use iommu_group_get() instead.

Fixes d290f1e70d85a ("iommu: Introduce iommu_request_dm_for_dev()")
---
 drivers/iommu/iommu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iommu/iommu.c +3 -3
index 67ee6623f9b2..3fa025f849e9 100644
@@ -1915,9 +1915,9 @@ int iommu_request_dm_for_dev(struct device *dev)
 	int ret;
 
 	/* Device must already be in a group before calling this function */
-	group = iommu_group_get_for_dev(dev);
-	if (IS_ERR(group))
-		return PTR_ERR(group);
+	group = iommu_group_get(dev);
+	if (!group)
+		return -EINVAL;
 
 	mutex_lock(&group->mutex);
 
Signature · 6 lines
2.17.1

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
maintainer Applied
#1 lore raw
Quoted 10 lines · Lu Baolu

The iommu_group_get_for_dev() will allocate a group for a device if it isn't in any group. This isn't the use case in iommu_request_dm_for_dev(). Let's use iommu_group_get() instead.

Fixes d290f1e70d85a ("iommu: Introduce iommu_request_dm_for_dev()")
---
 drivers/iommu/iommu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Applied, thanks.