All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yuan Can <yuancan@huawei.com>
To: <will@kernel.org>, <mark.rutland@arm.com>,
	<bbudiredla@marvell.com>, <suzuki.poulose@arm.com>,
	<Jonathan.Cameron@huawei.com>,
	<linux-arm-kernel@lists.infradead.org>
Cc: <yuancan@huawei.com>
Subject: [PATCH 1/2] perf: arm_dsu: Fix hotplug callback leak in dsu_pmu_init()
Date: Tue, 15 Nov 2022 07:02:06 +0000	[thread overview]
Message-ID: <20221115070207.32634-2-yuancan@huawei.com> (raw)
In-Reply-To: <20221115070207.32634-1-yuancan@huawei.com>

dsu_pmu_init() won't remove the callback added by cpuhp_setup_state_multi()
when platform_driver_register() failed. Remove the callback by
cpuhp_remove_multi_state() in fail path.

Similar to the handling of arm_ccn_init() in commit 26242b330093 ("bus:
arm-ccn: Prevent hotplug callback leak")

Fixes: 7520fa99246d ("perf: ARM DynamIQ Shared Unit PMU support")
Signed-off-by: Yuan Can <yuancan@huawei.com>
---
 drivers/perf/arm_dsu_pmu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/perf/arm_dsu_pmu.c b/drivers/perf/arm_dsu_pmu.c
index 4a15c86f45ef..fe2abb412c00 100644
--- a/drivers/perf/arm_dsu_pmu.c
+++ b/drivers/perf/arm_dsu_pmu.c
@@ -858,7 +858,11 @@ static int __init dsu_pmu_init(void)
 	if (ret < 0)
 		return ret;
 	dsu_pmu_cpuhp_state = ret;
-	return platform_driver_register(&dsu_pmu_driver);
+	ret = platform_driver_register(&dsu_pmu_driver);
+	if (ret)
+		cpuhp_remove_multi_state(dsu_pmu_cpuhp_state);
+
+	return ret;
 }
 
 static void __exit dsu_pmu_exit(void)
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-11-15  7:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15  7:02 [PATCH 0/2] perf: Fix some hotplug callback leaks Yuan Can
2022-11-15  7:02 ` Yuan Can [this message]
2022-11-15 11:44   ` [PATCH 1/2] perf: arm_dsu: Fix hotplug callback leak in dsu_pmu_init() Suzuki K Poulose
2022-11-15  7:02 ` [PATCH 2/2] drivers: perf: marvell_cn10k: Fix hotplug callback leak in tad_pmu_init() Yuan Can
2022-11-15 18:32 ` [PATCH 0/2] perf: Fix some hotplug callback leaks Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221115070207.32634-2-yuancan@huawei.com \
    --to=yuancan@huawei.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=bbudiredla@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.