From patchwork Wed Jan 18 09:02:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13105998 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 7FFD4C32793 for ; Wed, 18 Jan 2023 09:50:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229887AbjARJuT (ORCPT ); Wed, 18 Jan 2023 04:50:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230364AbjARJtZ (ORCPT ); Wed, 18 Jan 2023 04:49:25 -0500 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C19A893C1; Wed, 18 Jan 2023 01:01:04 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id DBF4A40012; Wed, 18 Jan 2023 09:01:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1674032463; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8z/Q2gyB/XYfvoTgyUKTlJZT/mKlDjrAbq9hj0Y/D0A=; b=iEyZ3aQ+4h9CQnWbkJCIwoSqekzHo+MiiACP8029LqTGD2NJSoztMy69tAM5jgxSDtQdQB nCK9i3Z+wQ/H/DYUO02Ts5BVa6B0xzGV93624icz4/7oe5PRBQLDd6f68+TlsxnTapIuUD iQ8H9Pt1QIBrfnXs+gnJcQc7d9zYQvKQquFqH0wiXVxu0T1P/a9UuUEIyGg6++r1jiAOBN BBRs90e3ADC9MhfwGOpUwOGM1CkbRZ02ca1R30lADrGTIHLNkDX4MFOnYVMQWZIRH7QCQA Hp9PPcZAxN96NDmscRuyoXn19UrBjC3IOghcV6InNIzF5ygaINpAs2TOO9c4eQ== From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Sylwester Nawrocki , Michael Turquette , Stephen Boyd Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Rob Herring , Frank Rowand , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] clk: add missing of_node_put() in "assigned-clocks" property parsing Date: Wed, 18 Jan 2023 10:02:47 +0100 Message-Id: <20230118090247.184596-1-clement.leger@bootlin.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org When returning from of_parse_phandle_with_args(), the np member of the of_phandle_args structure should be put after usage. Add missing of_node_put() calls in both __set_clk_parents() and __set_clk_rates(). Signed-off-by: Clément Léger --- drivers/clk/clk-conf.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk-conf.c b/drivers/clk/clk-conf.c index 2ef819606c41..1a4e6340f95c 100644 --- a/drivers/clk/clk-conf.c +++ b/drivers/clk/clk-conf.c @@ -33,9 +33,12 @@ static int __set_clk_parents(struct device_node *node, bool clk_supplier) else return rc; } - if (clkspec.np == node && !clk_supplier) + if (clkspec.np == node && !clk_supplier) { + of_node_put(clkspec.np); return 0; + } pclk = of_clk_get_from_provider(&clkspec); + of_node_put(clkspec.np); if (IS_ERR(pclk)) { if (PTR_ERR(pclk) != -EPROBE_DEFER) pr_warn("clk: couldn't get parent clock %d for %pOF\n", @@ -48,10 +51,12 @@ static int __set_clk_parents(struct device_node *node, bool clk_supplier) if (rc < 0) goto err; if (clkspec.np == node && !clk_supplier) { + of_node_put(clkspec.np); rc = 0; goto err; } clk = of_clk_get_from_provider(&clkspec); + of_node_put(clkspec.np); if (IS_ERR(clk)) { if (PTR_ERR(clk) != -EPROBE_DEFER) pr_warn("clk: couldn't get assigned clock %d for %pOF\n", @@ -93,10 +98,13 @@ static int __set_clk_rates(struct device_node *node, bool clk_supplier) else return rc; } - if (clkspec.np == node && !clk_supplier) + if (clkspec.np == node && !clk_supplier) { + of_node_put(clkspec.np); return 0; + } clk = of_clk_get_from_provider(&clkspec); + of_node_put(clkspec.np); if (IS_ERR(clk)) { if (PTR_ERR(clk) != -EPROBE_DEFER) pr_warn("clk: couldn't get clock %d for %pOF\n",