iommu: Use iommu_group_ref_get/put() for dev->iommu_group

No reason to open code this, use the proper helper functions.

Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/2-v3-328044aa278c+45e49-iommu_probe_jgg@nvidia.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
Jason Gunthorpe 2023-06-05 21:59:40 -03:00 committed by Joerg Roedel
parent 6eb4da8cf5
commit 5665d15d3c

View File

@ -500,7 +500,7 @@ static void __iommu_group_release_device(struct iommu_group *group,
kfree(grp_dev->name);
kfree(grp_dev);
dev->iommu_group = NULL;
kobject_put(group->devices_kobj);
iommu_group_put(group);
}
static void iommu_release_device(struct device *dev)
@ -1067,8 +1067,7 @@ rename:
goto err_free_name;
}
kobject_get(group->devices_kobj);
iommu_group_ref_get(group);
dev->iommu_group = group;
mutex_lock(&group->mutex);