From: Punit Agrawal <punit.agrawal@bytedance.com>
To: Shang XiaoJing <shangxiaojing@huawei.com>
Cc: <will@kernel.org>, <mark.rutland@arm.com>,
<robin.murphy@arm.com>, <tuanphan@os.amperecomputing.com>,
<shameerali.kolothum.thodi@huawei.com>, <nleeder@codeaurora.org>,
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/2] perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init()
Date: Tue, 15 Nov 2022 10:53:14 +0000 [thread overview]
Message-ID: <8735akzdyd.fsf@stealth> (raw)
In-Reply-To: <20221114133348.25705-2-shangxiaojing@huawei.com> (Shang XiaoJing's message of "Mon, 14 Nov 2022 21:33:47 +0800")
Shang XiaoJing <shangxiaojing@huawei.com> writes:
> dmc620_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: 53c218da220c ("driver/perf: Add PMU driver for the ARM DMC-620 memory controller")
> Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
> ---
> drivers/perf/arm_dmc620_pmu.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/perf/arm_dmc620_pmu.c b/drivers/perf/arm_dmc620_pmu.c
> index 280a6ae3e27c..d07054a05861 100644
> --- a/drivers/perf/arm_dmc620_pmu.c
> +++ b/drivers/perf/arm_dmc620_pmu.c
> @@ -725,6 +725,8 @@ static struct platform_driver dmc620_pmu_driver = {
>
> static int __init dmc620_pmu_init(void)
> {
> + int ret;
> +
> cpuhp_state_num = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN,
> DMC620_DRVNAME,
> NULL,
> @@ -732,7 +734,13 @@ static int __init dmc620_pmu_init(void)
> if (cpuhp_state_num < 0)
> return cpuhp_state_num;
>
> - return platform_driver_register(&dmc620_pmu_driver);
> + ret = platform_driver_register(&dmc620_pmu_driver);
> + if (ret) {
> + cpuhp_remove_multi_state(cpuhp_state_num);
> + return ret;
> + }
> +
> + return 0;
Nit: There's no need for two separate returns. Just return "ret" at the
bottom of the function.
With the change,
Reviewed-by: Punit Agrawal <punit.agrawal@bytedance.com>.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-11-15 11:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-14 13:33 [PATCH 0/2] perf: Fix some hotplug callbask leaks Shang XiaoJing
2022-11-14 13:33 ` [PATCH 1/2] perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init() Shang XiaoJing
2022-11-15 10:53 ` Punit Agrawal [this message]
2022-11-15 11:36 ` shangxiaojing
2022-11-14 13:33 ` [PATCH 2/2] perf/smmuv3: Fix hotplug callback leak in arm_smmu_pmu_init() Shang XiaoJing
2022-11-15 10:53 ` Punit Agrawal
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=8735akzdyd.fsf@stealth \
--to=punit.agrawal@bytedance.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=nleeder@codeaurora.org \
--cc=robin.murphy@arm.com \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=shangxiaojing@huawei.com \
--cc=tuanphan@os.amperecomputing.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox