linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
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 2/2] perf/smmuv3: Fix hotplug callback leak in arm_smmu_pmu_init()
Date: Tue, 15 Nov 2022 10:53:37 +0000	[thread overview]
Message-ID: <871qq4zdxq.fsf@stealth> (raw)
In-Reply-To: <20221114133348.25705-3-shangxiaojing@huawei.com> (Shang XiaoJing's message of "Mon, 14 Nov 2022 21:33:48 +0800")

Shang XiaoJing <shangxiaojing@huawei.com> writes:

> arm_smmu_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: 7d839b4b9e00 ("perf/smmuv3: Add arm64 smmuv3 pmu driver")
> Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
> ---
>  drivers/perf/arm_smmuv3_pmu.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c
> index 00d4c45a8017..82622861ec44 100644
> --- a/drivers/perf/arm_smmuv3_pmu.c
> +++ b/drivers/perf/arm_smmuv3_pmu.c
> @@ -959,6 +959,8 @@ static struct platform_driver smmu_pmu_driver = {
>  
>  static int __init arm_smmu_pmu_init(void)
>  {
> +	int ret;
> +
>  	cpuhp_state_num = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN,
>  						  "perf/arm/pmcg:online",
>  						  NULL,
> @@ -966,7 +968,13 @@ static int __init arm_smmu_pmu_init(void)
>  	if (cpuhp_state_num < 0)
>  		return cpuhp_state_num;
>  
> -	return platform_driver_register(&smmu_pmu_driver);
> +	ret = platform_driver_register(&smmu_pmu_driver);
> +	if (ret) {
> +		cpuhp_remove_multi_state(cpuhp_state_num);
> +		return ret;
> +	}
> +
> +	return 0;

Same comment as the previous patch.

With the changes,

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

      reply	other threads:[~2022-11-15 11:02 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
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 [this message]

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=871qq4zdxq.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;
as well as URLs for NNTP newsgroup(s).