From patchwork Wed Oct 19 08:29:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5114 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250934wrs; Wed, 19 Oct 2022 03:50:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6spxHnFDG+ry6Z7TXBafyLTTG1Mw4e5C1m4ltRRFVFpxZRl2dYBL0SKby9GYnD8iXc+0bX X-Received: by 2002:a17:906:fe45:b0:791:9624:9ea4 with SMTP id wz5-20020a170906fe4500b0079196249ea4mr6071675ejb.147.1666176624203; Wed, 19 Oct 2022 03:50:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176624; cv=none; d=google.com; s=arc-20160816; b=djmK+jge66g8rzf2UKo/4w54MJtMpt276+gJi1fKB3IzdVUqfeoR3OM6vcv3IZbkKp XQXXtDXdhvk7BpLlNzGHvFkTZsEjAxORauDBZM1HzYV0P9ocvV2KBLlEwGggq0ajL4Y0 8y5OFRoTR/k3DNfSPLuNsD5sGFVja95u1Csx6jI2fDoOPNv2pkwXvzEWXf7WgVZUBiav jErmw1eDPDUBWvw9M/PAQhJ+8wuospZ5u+GEZ0GpJJIdVgwEepqRRx5/C0eMh1QzZL1/ oceAUwAbNmfcUtdbq/eF8zYQO7BhKVhBY+hZHoq+liun7Gn4eHhcPCvFtWabXBFuvjPQ kqPA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MK5VI+3GBq8LdKsjE6o7xvZVfSAcQ8o/y+v9hNNFJts=; b=MG9cuf6q/yE/IadoTO3ZffK3BoFzgpLnwFRUI+jP9ag+n6qT2u1JNLKCZ1uMwEKF4L 8ZtaPFI4KGI67dR8e4nm6tOA/MaHJbGMgzXYMaePld4LRt0tDLnla1Sh/jZk2kb9Er4C KI22mDxKOFGcnm1EsqA8d6FRSwzROe/R8u1jUnzme35eTrGdG6cje8aOcnkavgLQVuHi Ke9my0jW07TpOwMR6jCp+moetoqTMZqfNci7nFQCFnnH/2pISa0Aa62FpTaG9hid4rgD kL5PZC8NlkPbtjcNYHh0BMwUAR9UYrZxUEXDLJSsduiFTYknhEv0svCSF7/RoJjAemqw K9zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OerNXwzj; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id da3-20020a056402176300b004582354990bsi11727114edb.454.2022.10.19.03.49.57; Wed, 19 Oct 2022 03:50:24 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=OerNXwzj; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234354AbiJSKsr (ORCPT + 99 others); Wed, 19 Oct 2022 06:48:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233412AbiJSKqp (ORCPT ); Wed, 19 Oct 2022 06:46:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40EC311F48B; Wed, 19 Oct 2022 03:21:38 -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 ams.source.kernel.org (Postfix) with ESMTPS id 9F253B82440; Wed, 19 Oct 2022 08:59:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E29CC433C1; Wed, 19 Oct 2022 08:59:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169948; bh=mgfxMUrqtSlUZHIjEaaKuLvZ8O/qKzLSst2rHPmyHgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OerNXwzjif7td4HsVbOdtW9klXGaOhtdyMt40EkYj8JURINlew1rTajrh6Y15Iv9T wlWUsdsLly+Kxoh50TsqmtXlrwwl+0XmjcrwtjwBtsgL0L2+zRbzCqyuGWza87lPAY RLn73Cku1iSegNyryoIEaBKpmK/D5lpvTfkf4hD0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 469/862] clk: st: Hold reference returned by of_get_parent() Date: Wed, 19 Oct 2022 10:29:16 +0200 Message-Id: <20221019083310.695992944@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1747112820307416850?= X-GMAIL-MSGID: =?utf-8?q?1747112820307416850?= From: Liang He [ Upstream commit 429973306f860470cbbb8402c8c53143b450faba ] We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Fixes: 3efe64ef5186 ("clk: st: clkgen-fsyn: search reg within node or parent") Fixes: 810251b0d36a ("clk: st: clkgen-mux: search reg within node or parent") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220628142416.169808-1-windhl@126.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/st/clkgen-fsyn.c | 5 ++++- drivers/clk/st/clkgen-mux.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c index 582a22c04919..d820292a381d 100644 --- a/drivers/clk/st/clkgen-fsyn.c +++ b/drivers/clk/st/clkgen-fsyn.c @@ -987,6 +987,7 @@ static void __init st_of_quadfs_setup(struct device_node *np, const char *pll_name, *clk_parent_name; void __iomem *reg; spinlock_t *lock; + struct device_node *parent_np; /* * First check for reg property within the node to keep backward @@ -994,7 +995,9 @@ static void __init st_of_quadfs_setup(struct device_node *np, */ reg = of_iomap(np, 0); if (!reg) { - reg = of_iomap(of_get_parent(np), 0); + parent_np = of_get_parent(np); + reg = of_iomap(parent_np, 0); + of_node_put(parent_np); if (!reg) { pr_err("%s: Failed to get base address\n", __func__); return; diff --git a/drivers/clk/st/clkgen-mux.c b/drivers/clk/st/clkgen-mux.c index ee39af7a0b72..596e939ad905 100644 --- a/drivers/clk/st/clkgen-mux.c +++ b/drivers/clk/st/clkgen-mux.c @@ -56,6 +56,7 @@ static void __init st_of_clkgen_mux_setup(struct device_node *np, void __iomem *reg; const char **parents; int num_parents = 0; + struct device_node *parent_np; /* * First check for reg property within the node to keep backward @@ -63,7 +64,9 @@ static void __init st_of_clkgen_mux_setup(struct device_node *np, */ reg = of_iomap(np, 0); if (!reg) { - reg = of_iomap(of_get_parent(np), 0); + parent_np = of_get_parent(np); + reg = of_iomap(parent_np, 0); + of_node_put(parent_np); if (!reg) { pr_err("%s: Failed to get base address\n", __func__); return;