Message ID | 20230131083227.10990-1-clement.leger@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2630791wrn; Tue, 31 Jan 2023 00:34:22 -0800 (PST) X-Google-Smtp-Source: AK7set8IZ6Q8BddfBrHwjXBxS6kBa8VXzrd6zgPjKbahjQWhnNRGbRouRuG93Gew7hI/A8zlKrSG X-Received: by 2002:a17:906:69c6:b0:884:b467:ae4a with SMTP id g6-20020a17090669c600b00884b467ae4amr10040257ejs.64.1675154062785; Tue, 31 Jan 2023 00:34:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675154062; cv=none; d=google.com; s=arc-20160816; b=07QDeCgUX6Q6mYv1iF06qu0FzOLqlWytlIou6OqRzmYfVMjA4tsTq9IvZqYWPV4Ysm Ln7V0cfeirk1cfBwGZmBrzGpAzmBZWQToj+xKLuM7hv4Vfocv4t5hcoItY6Gs4/2fBNr Lh1rvIehJeRgTexrpXntviIzKTUG3RC5MA3uS3J5fGXyESEUHUedRq3PirAYLE3CreSU +WG0fv4s8A+6G1gvAGRaoRmyfbizquPXMWoJCaomf5w1WbsAxVk+I98XUmhnyyD91um3 0eMsf08LV+mx779Z3jQbEXb8thuzUL0xsbRxf5FOujn36GYTbQEefcjApE67FRPg/Xv5 9SDQ== 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=ajrwn/groQlhkLs4SJ7ZwaJ9XDOkgLm/eBN16amo+YQ=; b=Wq2t/os04Ic1k462qKMiIR4QOuYfa3zzcCvyRWzn/guWNSQroOiLIsWxcLChbWqXiX PNeWmyzJ0NM3rvQV4jOyBKPuKqyO78IOR2SqAHGOUHQ+GosBQZrSfbXitj7nqe1x3D5V bkJFo08pT0Qr4tB4PqwtmI6/gQTo0zq6UejA4H51Xo8fCl1baGj7PWageFW6MeSurm9s Iiwy3Dh0wSh4Phw62uHvfK4GqV+pRirD9flNazfni642NVaMqEpIsZzv6NehoI8bZmdV /ftF7XnoJGBhJV2NhsoqbFyxy0zB7yBaT+VTf7jmCZt7pLlKnn0b28/9Oyqmpi8hxSyH hN8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="OwNt/8tk"; 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 19-20020a17090600d300b0084d34979417si19989143eji.323.2023.01.31.00.33.59; Tue, 31 Jan 2023 00:34:22 -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="OwNt/8tk"; 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 S230305AbjAaIax (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Tue, 31 Jan 2023 03:30:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbjAaIau (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 31 Jan 2023 03:30:50 -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 7EDB91B568; Tue, 31 Jan 2023 00:30:48 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 27D1C40005; Tue, 31 Jan 2023 08:30:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675153846; 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=ajrwn/groQlhkLs4SJ7ZwaJ9XDOkgLm/eBN16amo+YQ=; b=OwNt/8tkiHh5fwf3XqyErTgI8UCrtLcy2eE5f/XPpRKVMUS+47eIMD/2JQ6fdKI1baKrJy cnH8QZLebKEOOdr2W7uBHyBSEiI4LZbgwAwrBt9DxBDY+i3wYjByHjFASJZMZ8BUt94ctg An3KyNY2Dx1afu3JQEjEqS+628uMKbuNbSr1Ws8nfI6Zhl8IvlmTSheJyhvqxJ6libzfsr DUVgHe/9bj5egNp+qqzEvg+kHBn59RjFKHClCCBrnbLBB+QZQI4z4R6zhYfsOSJoJKx4lf MnU6WV63lY7xOn+9rxYMmtMlxH3XADo38HxEKtFiuklFekk8bHBnVdHXR1x1Ww== From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= <clement.leger@bootlin.com> To: Sylwester Nawrocki <s.nawrocki@samsung.com>, Michael Turquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@kernel.org> Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= <clement.leger@bootlin.com>, Rob Herring <robh+dt@kernel.org>, Frank Rowand <frowand.list@gmail.com>, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] clk: add missing of_node_put() in "assigned-clocks" property parsing Date: Tue, 31 Jan 2023 09:32:27 +0100 Message-Id: <20230131083227.10990-1-clement.leger@bootlin.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756526346386698342?= X-GMAIL-MSGID: =?utf-8?q?1756526346386698342?= |
Series |
[v2] clk: add missing of_node_put() in "assigned-clocks" property parsing
|
|
Commit Message
Clément Léger
Jan. 31, 2023, 8:32 a.m. UTC
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().
Fixes: 86be408bfbd8 ("clk: Support for clock parents and rates assigned from device tree")
Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
v2:
- Add "Fixes"
drivers/clk/clk-conf.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
Comments
Le Tue, 31 Jan 2023 09:32:27 +0100, Clément Léger <clement.leger@bootlin.com> a écrit : Ping ? > 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(). > > Fixes: 86be408bfbd8 ("clk: Support for clock parents and rates assigned from device tree") > Signed-off-by: Clément Léger <clement.leger@bootlin.com> > --- > v2: > - Add "Fixes" > > 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",
Le Mon, 20 Feb 2023 12:44:20 +0100, Clément Léger <clement.leger@bootlin.com> a écrit : Gentle ping. > Le Tue, 31 Jan 2023 09:32:27 +0100, > Clément Léger <clement.leger@bootlin.com> a écrit : > > Ping ? > > > 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(). > > > > Fixes: 86be408bfbd8 ("clk: Support for clock parents and rates assigned from device tree") > > Signed-off-by: Clément Léger <clement.leger@bootlin.com> > > --- > > v2: > > - Add "Fixes" > > > > 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", > > >
Quoting Clément Léger (2023-01-31 00:32:27) > 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(). > > Fixes: 86be408bfbd8 ("clk: Support for clock parents and rates assigned from device tree") > Signed-off-by: Clément Léger <clement.leger@bootlin.com> > --- Does this series from a year ago help[1]? [1] https://lore.kernel.org/all/20220623121857.886-1-nuno.sa@analog.com/ Nobody reviewed it, but if you can then I can probably apply it.
Le Tue, 14 Mar 2023 17:44:35 -0700, Stephen Boyd <sboyd@kernel.org> a écrit : > Quoting Clément Léger (2023-01-31 00:32:27) > > 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(). > > > > Fixes: 86be408bfbd8 ("clk: Support for clock parents and rates assigned from device tree") > > Signed-off-by: Clément Léger <clement.leger@bootlin.com> > > --- > > Does this series from a year ago help[1]? > > [1] https://lore.kernel.org/all/20220623121857.886-1-nuno.sa@analog.com/ > > Nobody reviewed it, but if you can then I can probably apply it. I'm only be able to review the first patch of the serie which is equivalent to what I did but it mixes refactoring and fixes.
Quoting Clément Léger (2023-01-31 00:32:27) > 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(). > > Fixes: 86be408bfbd8 ("clk: Support for clock parents and rates assigned from device tree") > Signed-off-by: Clément Léger <clement.leger@bootlin.com> > --- Applied to clk-next
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",