Skip to content

Commit

Permalink
iommu: Use iommu_group_ref_get/put() for dev->iommu_group
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jason Gunthorpe authored and Joerg Roedel committed Jul 14, 2023
1 parent 6eb4da8 commit 5665d15
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/iommu/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -1067,8 +1067,7 @@ int iommu_group_add_device(struct iommu_group *group, struct device *dev)
goto err_free_name;
}

kobject_get(group->devices_kobj);

iommu_group_ref_get(group);
dev->iommu_group = group;

mutex_lock(&group->mutex);
Expand Down

0 comments on commit 5665d15

Please sign in to comment.