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 9EC1AECAAD3 for ; Thu, 15 Sep 2022 11:31: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:In-Reply-To:MIME-Version:References: Message-ID: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=Q28AhQhpX2azl/iVjjFq1lPOWWfQBu6f8xmO12BzH90=; b=yd3Q80Xg3GMdtY 8EJUR9MlY0Y9p3U9BseLTYoTEl4ASfrBKmWUWKDawddNe0bgEYMZmRfBqOtN6DfOa8PH763LkR3vL j/mld5tk4vRMsNZKpyCG0ish2FXvul0raMJIPYw8wjcf4pkL6ghkcWQhfAe4DkvotkDcE1GjOJROx Uf9+4VznaRXDwEc30yPuuSfRe/8LwK2bEuDWY8l9Bwzm/GxoDjDOjIjOa7TUMBSOkS45dDAWSuTUl D2TWDnzTTClN56XmPSe4nRG2g0raUaQwUklyta5ANoVfh9jWWSFS6QG+cTJulkVw+1UiHvJe4fr7L UMeSWDtEVhZVZxpXRBHg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oYn4U-007i1N-Q5; Thu, 15 Sep 2022 11:30:18 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oYn4R-007hzA-FO for linux-arm-kernel@lists.infradead.org; Thu, 15 Sep 2022 11:30:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=TWsIrszG1AUUN64KBWKTE94mHdxzbqFx2i9yzCNJGJk=; b=hK4xxpXftpuWCD6fWdDplvYqAH XRbFeOMKdITt9YtoGuIcwtJaOJ/uHCxBGwuM3A68oc3QcQ7BtJpG3khhcK71S3MR2IrKgpHbhpJMx oFO6FfNyIjfpOuWWKWV7M07w+o8lMijrlabv0n4bIJyj6hK2ylGaFOHp6gwyfrXlaXSvbxuGFTrzu nHyrARqyV3IjlRjNupPFJeD4n5yP1UK9ATGYXvGW0jBhXxTE4KPN078htsYm3i/nvcVEkoe7f6f9T BEejtbYE+MPu8fbP8H2Vt7ksSnpymcOLOqDRVnJV8sFG18Lxrh6JZChAvtXpqj0JorabLvbw5zwir uR/+fmsg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:34346) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oYn4F-0005W9-8M; Thu, 15 Sep 2022 12:30:03 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1oYn4A-0002Zs-EK; Thu, 15 Sep 2022 12:29:58 +0100 Date: Thu, 15 Sep 2022 12:29:58 +0100 From: "Russell King (Oracle)" To: Liang He Cc: tony@atomide.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chenmengda2009@163.com Subject: Re: [PATCH] ARM: OMAP2+: Hold reference returned from of_find_xxx API Message-ID: References: <20220915014258.3999504-1-windhl@126.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220915014258.3999504-1-windhl@126.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220915_043015_535452_06DC6FF5 X-CRM114-Status: GOOD ( 18.36 ) 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 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. -- 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