* [PATCH] iommu/pamu: Consolidate pamu_domain_init() error handling
@ 2026-12-01 7:22 Wanhui Fu
2026-12-01 10:44 ` Jörg Rödel
0 siblings, 1 reply; 2+ messages in thread
From: Wanhui Fu @ 2026-12-01 7:22 UTC (permalink / raw)
To: joro, will, robin.murphy; +Cc: iommu, Wanhui Fu
The sysfs-add and IOMMU-registration failure paths in
pamu_domain_init() destroy the same two slab caches.
Add a common failure path to get rid of the duplication.
Signed-off-by: Wanhui Fu <fuwh1120@163.com>
---
This is a follow-up to "iommu/pamu: Free slab caches in pamu_domain_init()",
addressing Joerg's review comment about duplicated failure cleanup.
Compile-tested passed.
---
drivers/iommu/fsl_pamu_domain.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c
index 683bf005a3a2..c3252b2e8ae0 100644
--- a/drivers/iommu/fsl_pamu_domain.c
+++ b/drivers/iommu/fsl_pamu_domain.c
@@ -449,19 +449,21 @@ int __init pamu_domain_init(void)
return ret;
ret = iommu_device_sysfs_add(&pamu_iommu, NULL, NULL, "iommu0");
- if (ret) {
- kmem_cache_destroy(iommu_devinfo_cache);
- kmem_cache_destroy(fsl_pamu_domain_cache);
- return ret;
- }
+ if (ret)
+ goto out_destroy_caches;
ret = iommu_device_register(&pamu_iommu, &fsl_pamu_ops, NULL);
if (ret) {
- iommu_device_sysfs_remove(&pamu_iommu);
- kmem_cache_destroy(iommu_devinfo_cache);
- kmem_cache_destroy(fsl_pamu_domain_cache);
pr_err("Can't register iommu device\n");
+ goto out_remove_sysfs;
}
+ return 0;
+
+out_remove_sysfs:
+ iommu_device_sysfs_remove(&pamu_iommu);
+out_destroy_caches:
+ kmem_cache_destroy(iommu_devinfo_cache);
+ kmem_cache_destroy(fsl_pamu_domain_cache);
return ret;
}
base-commit: 25faec9ce61c01fb45abf812a222c5b43c3cd5c5
prerequisite-patch-id: d039757ac768fe2429618fce24a0694fa1d7b152
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iommu/pamu: Consolidate pamu_domain_init() error handling
2026-12-01 7:22 [PATCH] iommu/pamu: Consolidate pamu_domain_init() error handling Wanhui Fu
@ 2026-12-01 10:44 ` Jörg Rödel
0 siblings, 0 replies; 2+ messages in thread
From: Jörg Rödel @ 2026-12-01 10:44 UTC (permalink / raw)
To: Wanhui Fu; +Cc: will, robin.murphy, iommu
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-01 10:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 7:22 [PATCH] iommu/pamu: Consolidate pamu_domain_init() error handling Wanhui Fu
2026-12-01 10:44 ` Jörg Rödel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.