From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F007EC4332F for ; Tue, 15 Nov 2022 11:38:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:CC:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AJImw2zRqfrfZW39UFuzHzJHIMhAS8244s59pACxhP8=; b=tc+wDWxWJGrI6D zMgZYiLWZ3HFEUSVPZ1HFNnJsleb+sz0Erg/lenNwHOW8X7cn60VeBAdDdjjxTCJ6WHk6jQIKQyYR D3zG2+qa7cuMRZwslWjUmolPdNB1Unva2J7hBWfhSK9xav+hwrjH8gCAbQ4Ox9bZNsnqT1fYCScvn dPVoRim6pA8KiGJHl1ru9wtb2yQwtdiJRSdZg9B+YdEdN5KBBe+WJt8bhQd4nQC7lUaTxVi+3KPs6 LfYFvlXFC+2uVu5TDRXJoJj7HuGr0HkHIhZrc9p94la8lZoLoYJUme9qk+2vufW7Ln0YdyVMFSeOx LWJB/oOqKxDLjD9c9ZAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ouuFT-00AdSx-Gk; Tue, 15 Nov 2022 11:37:03 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ouuFP-00AdRD-Ry for linux-arm-kernel@lists.infradead.org; Tue, 15 Nov 2022 11:37:01 +0000 Received: from kwepemi500016.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NBPK041q9zRpCf; Tue, 15 Nov 2022 19:36:36 +0800 (CST) Received: from [10.174.176.230] (10.174.176.230) by kwepemi500016.china.huawei.com (7.221.188.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 15 Nov 2022 19:36:54 +0800 Message-ID: <6a63fca4-e71d-ccfb-3553-81789f1c678e@huawei.com> Date: Tue, 15 Nov 2022 19:36:52 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.1.0 Subject: Re: [PATCH 1/2] perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init() To: Punit Agrawal CC: , , , , , , References: <20221114133348.25705-1-shangxiaojing@huawei.com> <20221114133348.25705-2-shangxiaojing@huawei.com> <8735akzdyd.fsf@stealth> From: shangxiaojing In-Reply-To: <8735akzdyd.fsf@stealth> X-Originating-IP: [10.174.176.230] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemi500016.china.huawei.com (7.221.188.220) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221115_033700_101414_155E1BC7 X-CRM114-Status: GOOD ( 14.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2022/11/15 18:53, Punit Agrawal wrote: > Shang XiaoJing 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 >> --- >> 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 . Will be fixed in v2. Thanks, -- Shang XiaoJing _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel