Skip to contentSkip to conversation

iommu: Remove duplicate ida_free in iommu_group_alloc

PATCH Applied Yuan Can 2 participants 2 messages Aug 15, 2022 – Sep 7, 2022 IOMMU

lore
Share & tools
lore

Yuan Can

author
#0 lore raw

PATCH 1/1 iommu: Remove duplicate ida_free in iommu_group_alloc

In the iommu_group_alloc, when the kobject_init_and_add failed, the group->kobj is associate with iommu_group_ktype, thus its release function iommu_group_release will be called by the following kobject_put. The iommu_group_release calls ida_free with the group->id, so we do not need to do it before kobject_put.

---
 drivers/iommu/iommu.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iommu/iommu.c +0 -1
index 780fb7071577..74bc9111c7be 100644
@@ -654,7 +654,6 @@ struct iommu_group *iommu_group_alloc(void)
 	ret = kobject_init_and_add(&group->kobj, &iommu_group_ktype,
 				   NULL, "%d", group->id);
 	if (ret) {
-		ida_free(&iommu_group_ida, group->id);
 		kobject_put(&group->kobj);
 		return ERR_PTR(ret);
 	}
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw
Quoted 2 lines · Yuan Can
 drivers/iommu/iommu.c | 1 -
 1 file changed, 1 deletion(-)

Applied, thanks.