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 704D8CCA480 for ; Tue, 5 Jul 2022 12:20:27 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Message-ID:MIME-Version:References: In-Reply-To:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YRWs2sgZE3HOYR+7j8DFp0XRfhds0x4rh60W9pqasJg=; b=XyHkUDqzypHUAv S5IPTHeVvLmtSwbpryx+7eEp7f5RTePggnuOE7FYkM/3VlVcpspduFztMtvfDBqW/IoIRtLaygTYo 55dPvcj8FSwKQXKnRrzu0Ihu4cQa3rbtPpo5JicScEKSKVSN2nSnNdGLrbifMLmyoKYYr+O6CuaJu 5jArgKGFygMv26uSjVHOrrWT2qRl9N0YTbOYncFFKwYhI311D/RxYJHbuOXRwUr1W4pLpEHVwdb/v 1rML4T7MexzCKfrveOvCvSyy3BTO6JCW7UJ2noP7RyptEGVZxDynstuwctpJbcpqiA2hH8omOHT3B FVODMrbSuu4ehkTjB7AA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8hWW-0006wh-Kp; Tue, 05 Jul 2022 12:19:24 +0000 Received: from m1550.mail.126.com ([220.181.15.50]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8hWT-0006te-A0 for linux-arm-kernel@lists.infradead.org; Tue, 05 Jul 2022 12:19:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=Date:From:Subject:MIME-Version:Message-ID; bh=uS4L1 IumCS6HwLnskcQ6nlcpu/SkhEQWvQ6Xj7HoO7Q=; b=f4YP55oOMYQXfSwgCFCY7 c83Jz5LaZsLCDsiUPcC1Hfq+m+3/w1TbPbMhtZIwJ9Ua6KtqOeFL8LCZzyyD8EjS V2qoKouW285TxfbRUvEzCOLifcHHIjvoOKuqwjwNZIZWJkibIK5EwPd3yJcBTeLM wGYvNjamsHYxj8IJZfEWxA= Received: from windhl$126.com ( [124.16.139.61] ) by ajax-webmail-wmsvr50 (Coremail) ; Tue, 5 Jul 2022 20:18:19 +0800 (CST) X-Originating-IP: [124.16.139.61] Date: Tue, 5 Jul 2022 20:18:19 +0800 (CST) From: "Liang He" To: "Arnd Bergmann" Cc: "Florian Fainelli" , bcm-kernel-feedback-list , "Linux ARM" Subject: Re:Re: [PATCH] soc: brcmstb: pm: Add of_node_put() when the iteration breaks X-Priority: 3 X-Mailer: Coremail Webmail Server Version XT5.0.13 build 20220113(9671e152) Copyright (c) 2002-2022 www.mailtech.cn 126com In-Reply-To: References: <20220705112815.282835-1-windhl@126.com> MIME-Version: 1.0 Message-ID: <3a9f0155.76e4.181ce4c0cb0.Coremail.windhl@126.com> X-Coremail-Locale: zh_CN X-CM-TRANSID: MsqowAAHXfEMLMRiqc5DAA--.46388W X-CM-SenderInfo: hzlqvxbo6rjloofrz/1tbiuBE1F2JVkNVwkgADsY X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220705_051921_727893_D5981A31 X-CRM114-Status: UNSURE ( 9.11 ) X-CRM114-Notice: Please train this message. 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org At 2022-07-05 19:54:05, "Arnd Bergmann" wrote: >On Tue, Jul 5, 2022 at 1:28 PM Liang He wrote: >> --- a/drivers/soc/bcm/brcmstb/pm/pm-arm.c >> +++ b/drivers/soc/bcm/brcmstb/pm/pm-arm.c >> @@ -732,11 +732,13 @@ static int brcmstb_pm_probe(struct platform_device *pdev) >> i = ctrl.num_memc; >> if (i >= MAX_NUM_MEMC) { >> pr_warn("too many MEMCs (max %d)\n", MAX_NUM_MEMC); >> + of_node_put(dn); >> break; >> } >> >> base = of_io_request_and_map(dn, 0, dn->full_name); >> if (IS_ERR(base)) { >> + of_node_put(dn); >> if (!ctrl.support_warm_boot) >> break; >> >> @@ -752,12 +754,14 @@ static int brcmstb_pm_probe(struct platform_device *pdev) >> for_each_matching_node(dn, brcmstb_memc_of_match) { >> base = of_iomap(dn, 0); >> if (!base) { >> + of_node_put(dn); >> pr_err("error mapping DDR Sequencer %d\n", i); >> return -ENOMEM; >> } >> >> of_id = of_match_node(brcmstb_memc_of_match, dn); >> if (!of_id) { >> + of_node_put(dn); >> iounmap(base); >> return -EINVAL; >> } > >While all of these changes look correct to me, there seems to be a >larger issue in the error handling for these loops, as they also leak >the __iomem token returned by of_iomap()/of_io_request_and_map() >and by the earlier calls from this function. > >Can you try to rework the unwinding to address those as well? > > Arnd Hi, Arnd Thanks very much for your reply and your advice. I would like to give more useful patching work, but now I have only learned the 'device_node' related OF APIs. It will be easies if you could provide a special case to teach me how to patch of_io_xx related bugs or just a related link in lore.kernel.org. Thanks again, Liang _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel