From patchwork Mon Oct 24 11:29:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9898 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp573322wru; Mon, 24 Oct 2022 10:37:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7fgDRxlrZO1Ukqzay4m69PvAGzi4sL9ZnDrJ9ZTN++H+wLZA2jviSPfT1NDc977b3Tzq66 X-Received: by 2002:a63:4307:0:b0:464:a24d:8201 with SMTP id q7-20020a634307000000b00464a24d8201mr29484802pga.116.1666633073137; Mon, 24 Oct 2022 10:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666633073; cv=none; d=google.com; s=arc-20160816; b=NrTwXGVsmS1S1NMLaWwFFHEHX9U0YbNVB5ZCzVl2x5vF2mGZvoQPDvhJmz3X+C4b7r eJOAUYRd/7KIk08h/Jcyh1D5Yjuw1rPpFCK6MRonezdyXVSLYofCRdtDG7ul3pn9u1PU 24KbiXFKssHTIZiu70ASuRTgfI66V5GSfZgvNHX9IL3qYT1V/W/rwt31Q9HjhUT+Cfeg xBS0yD5uHvh5xmHSMrUqiYhOs4uuFVnBTKGNPOaq6UbeKtKfmL/6RebnyTZDAfwIyooD Uh6tN4ylLXfgPow2H4iotwX/uiveYAhU96mr6jcFLP87L7bNTEAlN4NL+f/1wLT0vToG VxvA== 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=2BlO5xQw41sr32b5hHQGkkyeUyT1l3KYFYQsFEdeIqA=; b=IA0Z7v+30FlurFnLNcfJjHzBpJhvdY21nUhhkYcrRlqsgCF16FLQZG5deiDVbt+2nh uHqU5jQvoDRqvxqq/De2SGMdtpKUIkyFgGqUudtxQm9p3e1kqmQgUM92/YQa6t0Iloip KmqQ6mZg/ci5S0BBjXUmik62SrkCFi70k8VQSpifxi5WxESyDmCL8qN43tHwfaoW6Rt8 hd74HAS6UvctE0ckUtwh7kUWSH9KCLluGE/dynxh86h54gKZF6gLW3YNrVSP3RP7O7BH +4+bTPKBxiYIoOPLdczH+QBJnj32rABaYztjAOhtqiT8MpUJjsKVizyjAieiZ3s7FHFl DN9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=amSUHUND; 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 j190-20020a6380c7000000b0046b2ebb0a4esi100714pgd.212.2022.10.24.10.37.39; Mon, 24 Oct 2022 10:37:53 -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=amSUHUND; 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 S233082AbiJXRhJ (ORCPT + 99 others); Mon, 24 Oct 2022 13:37:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233614AbiJXRgl (ORCPT ); Mon, 24 Oct 2022 13:36:41 -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 9FF46237967; Mon, 24 Oct 2022 09:11:41 -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 4E0E9B81675; Mon, 24 Oct 2022 12:24:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A0E8C433C1; Mon, 24 Oct 2022 12:24:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614266; bh=eSPGLgJoJM+kPIS2tJYcph+18AVY0zIp3pvdV3W6xAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=amSUHUNDcDxuAWJRy9rXcvezA0fSXCJ7Y/iUdjd/dvPzQcm9y4DwYAxhRnYWtFkeQ QBzTqsmurr15XmVCQnBXFxgDFNHszIDxsFEzUpINt2oLn0tJDGZ/Ae6503ct07K/01 +1IFKqxGCXPTvix4OsVCDjHyXbpZjrqSDi7oEvgU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Neil Armstrong , Martin Blumenstingl , Stephen Boyd , Sasha Levin Subject: [PATCH 5.10 196/390] clk: meson: Hold reference returned by of_get_parent() Date: Mon, 24 Oct 2022 13:29:53 +0200 Message-Id: <20221024113031.133178832@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747591440782345651?= X-GMAIL-MSGID: =?utf-8?q?1747591440782345651?= From: Liang He [ Upstream commit 89ab396d712f7c91fe94f55cff23460426f5fc81 ] We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Fixes: 88e2da81241e ("clk: meson: aoclk: refactor common code into dedicated file") Fixes: 6682bd4d443f ("clk: meson: factorise meson64 peripheral clock controller drivers") Fixes: bb6eddd1d28c ("clk: meson: meson8b: use the HHI syscon if available") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220628141038.168383-1-windhl@126.com Reviewed-by: Neil Armstrong Reviewed-by: Martin Blumenstingl Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/meson/meson-aoclk.c | 5 ++++- drivers/clk/meson/meson-eeclk.c | 5 ++++- drivers/clk/meson/meson8b.c | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/clk/meson/meson-aoclk.c b/drivers/clk/meson/meson-aoclk.c index 3a6d84cd6601..67d8a0d30221 100644 --- a/drivers/clk/meson/meson-aoclk.c +++ b/drivers/clk/meson/meson-aoclk.c @@ -36,6 +36,7 @@ int meson_aoclkc_probe(struct platform_device *pdev) struct meson_aoclk_reset_controller *rstc; struct meson_aoclk_data *data; struct device *dev = &pdev->dev; + struct device_node *np; struct regmap *regmap; int ret, clkid; @@ -47,7 +48,9 @@ int meson_aoclkc_probe(struct platform_device *pdev) if (!rstc) return -ENOMEM; - regmap = syscon_node_to_regmap(of_get_parent(dev->of_node)); + np = of_get_parent(dev->of_node); + regmap = syscon_node_to_regmap(np); + of_node_put(np); if (IS_ERR(regmap)) { dev_err(dev, "failed to get regmap\n"); return PTR_ERR(regmap); diff --git a/drivers/clk/meson/meson-eeclk.c b/drivers/clk/meson/meson-eeclk.c index a7cb1e7aedc4..18ae38787268 100644 --- a/drivers/clk/meson/meson-eeclk.c +++ b/drivers/clk/meson/meson-eeclk.c @@ -17,6 +17,7 @@ int meson_eeclkc_probe(struct platform_device *pdev) { const struct meson_eeclkc_data *data; struct device *dev = &pdev->dev; + struct device_node *np; struct regmap *map; int ret, i; @@ -25,7 +26,9 @@ int meson_eeclkc_probe(struct platform_device *pdev) return -EINVAL; /* Get the hhi system controller node */ - map = syscon_node_to_regmap(of_get_parent(dev->of_node)); + np = of_get_parent(dev->of_node); + map = syscon_node_to_regmap(np); + of_node_put(np); if (IS_ERR(map)) { dev_err(dev, "failed to get HHI regmap\n"); diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c index 862f0756b50f..1da9d212f8b7 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -3735,13 +3735,16 @@ static void __init meson8b_clkc_init_common(struct device_node *np, struct clk_hw_onecell_data *clk_hw_onecell_data) { struct meson8b_clk_reset *rstc; + struct device_node *parent_np; const char *notifier_clk_name; struct clk *notifier_clk; void __iomem *clk_base; struct regmap *map; int i, ret; - map = syscon_node_to_regmap(of_get_parent(np)); + parent_np = of_get_parent(np); + map = syscon_node_to_regmap(parent_np); + of_node_put(parent_np); if (IS_ERR(map)) { pr_info("failed to get HHI regmap - Trying obsolete regs\n");