From patchwork Tue Jan 31 08:32:27 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: 50682 Return-Path: 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 + 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 ); 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?= 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 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 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?1756526346386698342?= X-GMAIL-MSGID: =?utf-8?q?1756526346386698342?= 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 --- 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",