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: 45131 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2248594wrn; Wed, 18 Jan 2023 02:09:07 -0800 (PST) X-Google-Smtp-Source: AMrXdXvcCPdQYn/0JttpPpdUtCHq2xE2nx57cnnqWEQH6OMXnNsgGI4uveDyT5mo13PPxZmBj55s X-Received: by 2002:a17:906:c50:b0:862:fc76:6f8e with SMTP id t16-20020a1709060c5000b00862fc766f8emr5967072ejf.36.1674036547392; Wed, 18 Jan 2023 02:09:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674036547; cv=none; d=google.com; s=arc-20160816; b=Or4X8gvDFd0Vd3NT5pPObyCn2eSSUyjha7EoZscwb4hbCFJfXNyhRnRt+BQHuMwxaV Jx9clIVFwM9n3O50mCWzVE+423HqOdDFBkUTyp6ZI2wnNvi0g1vbKRLdmGcng+1Thozw +kCBEsGnm4DNk9fhV9ktZyFduYNessNvrUjhGi6PnqshItqnMNPccn7dZczjbRZRqlf5 aO9O5rxo8sYq5YFQDhvDQPL5qFKG+lriaEamekD0O57LCB8qG6tyWXZIccwBO1aqe/H9 O8x+a/VDDueQloFYSXSdX17KJq6a/GmcNIR+45BWfOcZ7Sto4vBW79qvMXvVtyeUKE3Z oAMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=8z/Q2gyB/XYfvoTgyUKTlJZT/mKlDjrAbq9hj0Y/D0A=; b=sZs9HHm/nLaab4p1MFR/l8QZ2M7L0MkmiinpvSgFUK9F3wDASYqh3NmryWCE6tIp6j OdJHeEVhv3eASXEUk+aNhFKv9AYM91APoueobGJtpr40azEHcRki6yIy5dOIiecIjwXG vZHDrxz0vj8ueXxGikLAyd9Nzs6e0irpnSmjFmTYIGws0v4Sozc3htG6312yayUBuftp vGtv55/9YyBQWVS8kEeXpE+E6cRl4cI+o2n9Nv7oAwE0cWAGbQiTAF0ySA5QS+qqEBuF /9joq/V4OeduxSo8/OWXFfZwlQ9UGk9ENuaFMBvxZ9dkrw1GmKTjHYmvxpqacAr07dPb IbWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=iEyZ3aQ+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd17-20020a170907629100b007c195fb9e24si37835727ejc.42.2023.01.18.02.08.42; Wed, 18 Jan 2023 02:09:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=iEyZ3aQ+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230123AbjARJue (ORCPT + 99 others); Wed, 18 Jan 2023 04:50:34 -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 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755354546770980802?= X-GMAIL-MSGID: =?utf-8?q?1755354546770980802?= 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",