Commit bf75eb44 authored by Yuan Can's avatar Yuan Can Committed by Joerg Roedel

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.
Signed-off-by: default avatarYuan Can <yuancan@huawei.com>
Link: https://lore.kernel.org/r/20220815031423.94548-1-yuancan@huawei.comSigned-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 28394501
...@@ -654,7 +654,6 @@ struct iommu_group *iommu_group_alloc(void) ...@@ -654,7 +654,6 @@ struct iommu_group *iommu_group_alloc(void)
ret = kobject_init_and_add(&group->kobj, &iommu_group_ktype, ret = kobject_init_and_add(&group->kobj, &iommu_group_ktype,
NULL, "%d", group->id); NULL, "%d", group->id);
if (ret) { if (ret) {
ida_free(&iommu_group_ida, group->id);
kobject_put(&group->kobj); kobject_put(&group->kobj);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment