[PATCH 3/4] perf: nvidia_t410_c2c: fix cpuhp state leak on init failure
Besar Wicaksono
bwicaksono at nvidia.com
Thu May 14 08:57:02 PDT 2026
> -----Original Message-----
> From: Saurav Sachidanand <sauravsc at amazon.com>
> Sent: Wednesday, May 13, 2026 8:06 PM
> To: Will Deacon <will at kernel.org>
> Cc: Mark Rutland <mark.rutland at arm.com>; Besar Wicaksono
> <bwicaksono at nvidia.com>; Ilkka Koskinen
> <ilkka at os.amperecomputing.com>; Andi Shyti <andi.shyti at kernel.org>; linux-
> arm-kernel at lists.infradead.org; linux-perf-users at vger.kernel.org; linux-
> kernel at vger.kernel.org; aghayev at amazon.com; juew at amazon.com; Saurav
> Sachidanand <sauravsc at amazon.com>
> Subject: [PATCH 3/4] perf: nvidia_t410_c2c: fix cpuhp state leak on init failure
>
> External email: Use caution opening links or attachments
>
>
> If platform_driver_register() fails, the cpuhp multi-state registered
> by cpuhp_setup_state_multi() is never cleaned up. Add
> cpuhp_remove_multi_state() on the error path, mirroring the cleanup
> in nv_c2c_pmu_exit().
>
> Fixes: 2f89b7f78c50 ("perf: add NVIDIA Tegra410 C2C PMU")
> Signed-off-by: Saurav Sachidanand <sauravsc at amazon.com>
> ---
> drivers/perf/nvidia_t410_c2c_pmu.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/perf/nvidia_t410_c2c_pmu.c
> b/drivers/perf/nvidia_t410_c2c_pmu.c
> index 411987153ff3f..662fa1bc833a5 100644
> --- a/drivers/perf/nvidia_t410_c2c_pmu.c
> +++ b/drivers/perf/nvidia_t410_c2c_pmu.c
> @@ -1034,7 +1034,12 @@ static int __init nv_c2c_pmu_init(void)
> return ret;
>
> nv_c2c_pmu_cpuhp_state = ret;
> - return platform_driver_register(&nv_c2c_pmu_driver);
> +
> + ret = platform_driver_register(&nv_c2c_pmu_driver);
> + if (ret)
> + cpuhp_remove_multi_state(nv_c2c_pmu_cpuhp_state);
> +
> + return ret;
> }
>
> static void __exit nv_c2c_pmu_exit(void)
> --
> 2.47.3
Reviewed-by: Besar Wicaksono <bwicaksono at nvidia.com>
More information about the linux-arm-kernel
mailing list