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 6AF36C32771 for ; Mon, 26 Sep 2022 10:19:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234794AbiIZKTX (ORCPT ); Mon, 26 Sep 2022 06:19:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235119AbiIZKRh (ORCPT ); Mon, 26 Sep 2022 06:17:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DCE83F31C; Mon, 26 Sep 2022 03:15:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 66CFD60BFE; Mon, 26 Sep 2022 10:15:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58BD5C433D6; Mon, 26 Sep 2022 10:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187305; bh=KZ2/UYyi2UeRP/7S3TXv7BylaBfnuZkXyL4LhPepjYQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EHk3iea5mR1aTRI3kIjTSG75Rx+/Un7FdOUtFRHAH6tW8RV5KjhFpnLthfi4bLFZh CXZ2ZAI8PeInlqTEkNrpUMptYEoL2Ja1fu4DVuxOw6l3Y4BRc4oQ7BC20A78imknJ5 EZoYOjya5pcKK41gQ0i/e5CxRnalXEOqNsjdihwc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Viresh Kumar , Arnd Bergmann , Sasha Levin Subject: [PATCH 4.9 12/30] arm: mach-spear: Add missing of_node_put() in time.c Date: Mon, 26 Sep 2022 12:11:43 +0200 Message-Id: <20220926100736.617492501@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100736.153157100@linuxfoundation.org> References: <20220926100736.153157100@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Liang He [ Upstream commit 2c629dd2d14fd7f64a553f809eda6d0b3a4f615a ] In spear_setup_of_timer(), of_find_matching_node() will return a node pointer with refcount incrementd. We should use of_node_put() in each fail path or when it is not used anymore. Signed-off-by: Liang He Acked-by: Viresh Kumar Link: https://lore.kernel.org/r/20220616093027.3984903-1-windhl@126.com' Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin --- arch/arm/mach-spear/time.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-spear/time.c b/arch/arm/mach-spear/time.c index aaaa6781b9fe..57b77c7effa9 100644 --- a/arch/arm/mach-spear/time.c +++ b/arch/arm/mach-spear/time.c @@ -223,13 +223,13 @@ void __init spear_setup_of_timer(void) irq = irq_of_parse_and_map(np, 0); if (!irq) { pr_err("%s: No irq passed for timer via DT\n", __func__); - return; + goto err_put_np; } gpt_base = of_iomap(np, 0); if (!gpt_base) { pr_err("%s: of iomap failed\n", __func__); - return; + goto err_put_np; } gpt_clk = clk_get_sys("gpt0", NULL); @@ -244,6 +244,8 @@ void __init spear_setup_of_timer(void) goto err_prepare_enable_clk; } + of_node_put(np); + spear_clockevent_init(irq); spear_clocksource_init(); @@ -253,4 +255,6 @@ void __init spear_setup_of_timer(void) clk_put(gpt_clk); err_iomap: iounmap(gpt_base); +err_put_np: + of_node_put(np); } -- 2.35.1