* [PATCH] perf: tegra410: Fix CMEM PMU init error cleanup
@ 2026-11-28 13:23 Jiangtian Feng
2026-11-28 13:26 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Jiangtian Feng @ 2026-11-28 13:23 UTC (permalink / raw)
To: Will Deacon, Mark Rutland, Besar Wicaksono
Cc: Ilkka Koskinen, linux-arm-kernel, linux-perf-users, linux-kernel,
Jiangtian Feng
If platform_driver_register() fails after cpuhp_setup_state_multi()
succeeds, the dynamically allocated CPU hotplug state remains registered.
Remove the state before returning the registration error.
Qoder, an AI coding assistant, helped analyze the issue, develop the fix,
and draft this description.
Fixes: 429b7638b2df ("perf: add NVIDIA Tegra410 CPU Memory Latency PMU")
Signed-off-by: Jiangtian Feng <jiangtianfeng@linux.alibaba.com>
---
Validation (two-patch tree):
- ARM64 defconfig W=1 build of the CMEM target object
- complete ARM64 Image and CMEM module modpost/final link
- checkpatch.pl reports 0 errors and 0 warnings for the code diff
NOT_RUN:
- runtime platform_driver_register() failure injection or module loading
- CPU hotplug, real PMU events, or target hardware testing
drivers/perf/nvidia_t410_cmem_latency_pmu.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/perf/nvidia_t410_cmem_latency_pmu.c b/drivers/perf/nvidia_t410_cmem_latency_pmu.c
index f1eff644b0ba..71b2f04b57f1 100644
--- a/drivers/perf/nvidia_t410_cmem_latency_pmu.c
+++ b/drivers/perf/nvidia_t410_cmem_latency_pmu.c
@@ -719,7 +719,11 @@ static int __init cmem_lat_pmu_init(void)
cmem_lat_pmu_cpuhp_state = ret;
- return platform_driver_register(&cmem_lat_pmu_driver);
+ ret = platform_driver_register(&cmem_lat_pmu_driver);
+ if (ret)
+ cpuhp_remove_multi_state(cmem_lat_pmu_cpuhp_state);
+
+ return ret;
}
static void __exit cmem_lat_pmu_exit(void)
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-28 13:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28 13:23 [PATCH] perf: tegra410: Fix CMEM PMU init error cleanup Jiangtian Feng
2026-11-28 13:26 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox