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 8A3CDECAAD3 for ; Thu, 15 Sep 2022 12:43:53 +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=YIcPrC76oIPyuHBWGehFyBVjlRuNKbOQBCPg1kfSqP4=; b=4nujs8WQ41jBpd x+1ESAhrcBdnVWbRiRU1Kqq11gRvQSaD3KcPTmGjDGE/lg35+5H3KVaTB1KkqE9qDi3xqiiktZh4y DK5FZja7CBeOYUlwmD7XRwDxTgrrIh3szXosuC6MZpak5z/jw7/TmbdX5avN0JNWs7pj3lT/6lFB+ NJ0Z0iJ+akXQ8KeaBXhyKYwLs7lLJvYY1fSD/IvkjcsDqcy24Okzd/wIaL6zZ1CWIi7tEZU4oRXCZ /OtPa1lc8VNxctrlNgbmzk7oiT1UYfFYSoBu1BKypJ47zP6QEm5DtqCOpE9USgur4BNey6ujH1d2N PaU4otrTVWEoMO5+gXiA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oYoCY-008n5g-VO; Thu, 15 Sep 2022 12:42:43 +0000 Received: from m1524.mail.126.com ([220.181.15.24]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oYoCV-008mXg-CV for linux-arm-kernel@lists.infradead.org; Thu, 15 Sep 2022 12:42:41 +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=bUqev mQkiasDs3rj+QQsV1i1zWnd/VIJCE87i0de9uY=; b=Qtrnai/RD8yyZGcOI8sLH P+FNDQX1VIHf8st9/9CDs79ktZoNJOPZrX/hFUuPqHnxGFQ8OCWv3p5ZGBkzrKeP 9QBzro4fWf6E7DyFue1a8fsq601mCyLmePHK3yGYZvFYyBqTAvgjN4Rfn7YdYJkQ H06Re2zSe3YwqqQR1RUDuE= Received: from windhl$126.com ( [8.219.73.50, 14.29.82.34] ) by ajax-webmail-wmsvr24 (Coremail) ; Thu, 15 Sep 2022 20:41:36 +0800 (CST) X-Originating-IP: [8.219.73.50, 14.29.82.34] Date: Thu, 15 Sep 2022 20:41:36 +0800 (CST) From: "Liang He" To: "Russell King (Oracle)" Cc: tony@atomide.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chenmengda2009@163.com Subject: Re:Re: [PATCH] ARM: OMAP2+: Hold reference returned from of_find_xxx API 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: <20220915014258.3999504-1-windhl@126.com> MIME-Version: 1.0 Message-ID: <7b0dd7d7.76f8.183412b3f13.Coremail.windhl@126.com> X-Coremail-Locale: zh_CN X-CM-TRANSID: GMqowACHjyeBHSNjemV2AA--.38320W X-CM-SenderInfo: hzlqvxbo6rjloofrz/1tbi2hp9F1uwMvl-+gABsO X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220915_054239_764131_849729A6 X-CRM114-Status: GOOD ( 10.64 ) 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-09-15 19:29:58, "Russell King (Oracle)" wrote: >On Thu, Sep 15, 2022 at 09:42:58AM +0800, Liang He wrote: >> In omap4_twl_init(), we should hold the reference returned from >> of_find_compatible_node() which has increased the refcount and >> then call of_node_put() with it when done. >> >> Fixes: ccd369455a23 ("ARM: OMAP2+: Remove bogus warnings for machines without twl PMIC") >> Signed-off-by: Liang He >> Signed-off-by: Mengda Chen >> --- >> arch/arm/mach-omap2/omap_twl.c | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c >> index d4dab041324d..07b5f17066ce 100644 >> --- a/arch/arm/mach-omap2/omap_twl.c >> +++ b/arch/arm/mach-omap2/omap_twl.c >> @@ -213,11 +213,13 @@ static struct omap_voltdm_pmic omap4_core_pmic = { >> int __init omap4_twl_init(void) >> { >> struct voltagedomain *voltdm; >> + struct device_node *np; >> >> if (!cpu_is_omap44xx() || >> - of_find_compatible_node(NULL, NULL, "motorola,cpcap")) >> + (np = of_find_compatible_node(NULL, NULL, "motorola,cpcap"))) { >> + of_node_put(np); > >This is buggy - if cpu_is_omap44xx() is false, then np will not be >initialised. The simple solution is to initialise np to NULL. > Thanks, I will send a new version soon. Liang >-- >RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ >FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel