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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CD4CC433EF for ; Tue, 28 Jun 2022 03:59:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244156AbiF1D7s (ORCPT ); Mon, 27 Jun 2022 23:59:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244143AbiF1D7r (ORCPT ); Mon, 27 Jun 2022 23:59:47 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1A4A229803; Mon, 27 Jun 2022 20:59:47 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 70BC78106; Tue, 28 Jun 2022 03:54:34 +0000 (UTC) Date: Tue, 28 Jun 2022 06:59:45 +0300 From: Tony Lindgren To: Liang He Cc: andre.przywara@arm.com, thierry.reding@gmail.com, jonathanh@nvidia.com, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-tegra@vger.kernel.org, Krzysztof Kozlowski Subject: Re: [PATCH] arm/mach: Hold reference returned by of_find_xxx APIs Message-ID: References: <20220621091937.4082422-1-windhl@126.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220621091937.4082422-1-windhl@126.com> Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org * Liang He [220621 12:14]: > diff --git a/arch/arm/mach-omap2/pmic-cpcap.c b/arch/arm/mach-omap2/pmic-cpcap.c > index 668dc84fd31e..a7368d657aa8 100644 > --- a/arch/arm/mach-omap2/pmic-cpcap.c > +++ b/arch/arm/mach-omap2/pmic-cpcap.c > @@ -238,8 +238,11 @@ static struct omap_voltdm_pmic omap4_fan_iva = { > int __init omap4_cpcap_init(void) > { > struct voltagedomain *voltdm; > + struct device_node *np; > > - if (!of_find_compatible_node(NULL, NULL, "motorola,cpcap")) > + np = of_find_compatible_node(NULL, NULL, "motorola,cpcap"); > + of_node_put(np); > + if (!np) > return -ENODEV; Hmm so here you are checking for !np after of_node_put()? > diff --git a/arch/arm/mach-tegra/irq.c b/arch/arm/mach-tegra/irq.c > index 4e1ee70b2a3f..2aeac041bcb9 100644 > --- a/arch/arm/mach-tegra/irq.c > +++ b/arch/arm/mach-tegra/irq.c > @@ -88,7 +88,11 @@ static const struct of_device_id tegra_ictlr_match[] __initconst = { > > void __init tegra_init_irq(void) > { > - if (WARN_ON(!of_find_matching_node(NULL, tegra_ictlr_match))) > + struct device_node *np; > + > + np = of_find_matching_node(NULL, tegra_ictlr_match); > + of_node_put(np); > + if (WARN_ON(!np)) > pr_warn("Outdated DT detected, suspend/resume will NOT work\n"); > > tegra114_gic_cpu_pm_registration(); Here too. Regards, Tony 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 598DAC433EF for ; Tue, 28 Jun 2022 04:01:50 +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=4sMslSjK6jwURYNndPR6qZs3VDvRtXBd++x5qmUFoQY=; b=O3lkaQtEKG40Od 9OwzGMRBcGqM3aXZpM5S8vhOaeQb9N8DgpPGmn4FiSoY18bmPuhyGQts1rRmac5yLvayu+lBTlqp3 X1hztbZIoofx2X9yz8wcG5DMHEgYK16/VyF8BC1Y1egXB+8ENbNcUrvr8OaZbJkp8l848xGJpMyyo qF9jaFhTbyjvKBAe/pmJpc4+zOY83NLzora7sOnqZuOHhBXYptO82E0XeSSJdRmqr6mQ98TQs3Jfv L4sg1CtUynJxyTrSZw9N4pTftyO82Y9eLR/hGHltivKq4Fbos51lI8Zv4hfDm28yX3jkDvPctT4xr WYEtqxMKhE/yq10/dDew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o62OF-0046l2-VT; Tue, 28 Jun 2022 03:59:52 +0000 Received: from muru.com ([72.249.23.125]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o62OC-0046kC-NN for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 03:59:50 +0000 Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 70BC78106; Tue, 28 Jun 2022 03:54:34 +0000 (UTC) Date: Tue, 28 Jun 2022 06:59:45 +0300 From: Tony Lindgren To: Liang He Cc: andre.przywara@arm.com, thierry.reding@gmail.com, jonathanh@nvidia.com, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-tegra@vger.kernel.org, Krzysztof Kozlowski Subject: Re: [PATCH] arm/mach: Hold reference returned by of_find_xxx APIs Message-ID: References: <20220621091937.4082422-1-windhl@126.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220621091937.4082422-1-windhl@126.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220627_205948_841135_2364237C X-CRM114-Status: GOOD ( 13.38 ) 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 * Liang He [220621 12:14]: > diff --git a/arch/arm/mach-omap2/pmic-cpcap.c b/arch/arm/mach-omap2/pmic-cpcap.c > index 668dc84fd31e..a7368d657aa8 100644 > --- a/arch/arm/mach-omap2/pmic-cpcap.c > +++ b/arch/arm/mach-omap2/pmic-cpcap.c > @@ -238,8 +238,11 @@ static struct omap_voltdm_pmic omap4_fan_iva = { > int __init omap4_cpcap_init(void) > { > struct voltagedomain *voltdm; > + struct device_node *np; > > - if (!of_find_compatible_node(NULL, NULL, "motorola,cpcap")) > + np = of_find_compatible_node(NULL, NULL, "motorola,cpcap"); > + of_node_put(np); > + if (!np) > return -ENODEV; Hmm so here you are checking for !np after of_node_put()? > diff --git a/arch/arm/mach-tegra/irq.c b/arch/arm/mach-tegra/irq.c > index 4e1ee70b2a3f..2aeac041bcb9 100644 > --- a/arch/arm/mach-tegra/irq.c > +++ b/arch/arm/mach-tegra/irq.c > @@ -88,7 +88,11 @@ static const struct of_device_id tegra_ictlr_match[] __initconst = { > > void __init tegra_init_irq(void) > { > - if (WARN_ON(!of_find_matching_node(NULL, tegra_ictlr_match))) > + struct device_node *np; > + > + np = of_find_matching_node(NULL, tegra_ictlr_match); > + of_node_put(np); > + if (WARN_ON(!np)) > pr_warn("Outdated DT detected, suspend/resume will NOT work\n"); > > tegra114_gic_cpu_pm_registration(); Here too. Regards, Tony _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel