From patchwork Wed Oct 19 08:29:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4744 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214472wrs; Wed, 19 Oct 2022 02:12:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM560sadVnGpm5Ii85xmNgSB8U07fSjllnXdVslRL0eqIVlzZjGp8kQY/ETMnLBNa1dRGkSJ X-Received: by 2002:a05:6402:3641:b0:45c:4231:ddcc with SMTP id em1-20020a056402364100b0045c4231ddccmr6423345edb.224.1666170775013; Wed, 19 Oct 2022 02:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170775; cv=none; d=google.com; s=arc-20160816; b=NC90qAUKISAq9VAHeV579J3OZIs9Z+6Hy/Fdz6LIs3PnhG/XeGr6UKc3GQ3tSJinev 3YCKCsbvcZdj8WR+sT/ToTLUcuCY4oN0Y1zRC9GGAFR0EIhvE/FV2fhNJPlu2qqWEMvI 012jCaZREbevutQDCXUALsXXuCmogYChbdFXh/RS7q8BfSvwWqAnF4YPV80Qw001AjOd N2nSRtOxFea6JeeI8smVlLclID6JdGOXo1U3sLTJOTGeYyhgENMX8CgaOGfx1+7j/wNa qiP5oApr96G7Xmg9SSQb62RH6uH++FmJNnNsVHqvGGpxoW9+tKdrmdr7Rmo+P29Hx8pl w2cA== 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=YepjPZ/t+MCEPPZTFgrI/o/66+Pt4E1x6AtaHKSGv6o=; b=DNWjzibIbDdQCwakVC3B0diayoLonMupBUKwjG8yZiHKTZg4vcNdjgfhnGgNO/8BrI /OeItrRxhiIMY42ScgKypTM5b0zzeWrBbSusaOyW2IpIgdeX8a9VINkGpccOUFTCGE6h vfvSwt5GjuuFv3o2EqECtKa7+mdsEasMe6Yq+8yLpR/OFM9OtL8bqFPWcq06J34+shYG fIKAwCLw51Tngz5Jhi5TCFgubcBcJrVnlSMYzxYke+1hDZRa1mS4SS2Oai2t3dQtnbQJ //c9kR+W3VNdbRYKGygCWu/SQQ5f4/kWZBMMQOXgV+4BCSttGOUJAeYFMcDK06r+T541 YK+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="2E+IRnR/"; 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 ay17-20020a170906d29100b00782b261ea21si11136442ejb.729.2022.10.19.02.12.30; Wed, 19 Oct 2022 02:12:55 -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="2E+IRnR/"; 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 S232600AbiJSJKs (ORCPT + 99 others); Wed, 19 Oct 2022 05:10:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232607AbiJSJHs (ORCPT ); Wed, 19 Oct 2022 05:07:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA3A565240; Wed, 19 Oct 2022 02:00:06 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 6264261825; Wed, 19 Oct 2022 08:59:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74CFCC433D6; Wed, 19 Oct 2022 08:59:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169945; bh=iyKhAeS+fL/4paGpY198m4bprWGcYWFl+THorYYK8i8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2E+IRnR/Z3C6WciJO1lT+otRiR+gPJrTO/jinnvZQE0Mls3RbUAqxunEtkGtjfKFP gKqKRE9/oZmNVW5dzNsKurI3NvCSg/bIN8LK3ydmkaeoWDLEsHiIbmmp0yUlvvIO1e 6siISnCvCg2N3bXRhymb9ZumFn0PTi8wdhZcc8rQ= 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 6.0 468/862] clk: meson: Hold reference returned by of_get_parent() Date: Wed, 19 Oct 2022 10:29:15 +0200 Message-Id: <20221019083310.661781345@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?1747106686145206728?= X-GMAIL-MSGID: =?utf-8?q?1747106686145206728?= 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 27cd2c1f3f61..434cd8f9de82 100644 --- a/drivers/clk/meson/meson-aoclk.c +++ b/drivers/clk/meson/meson-aoclk.c @@ -38,6 +38,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; @@ -49,7 +50,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 8d5a5dab955a..0e5e6b57eb20 100644 --- a/drivers/clk/meson/meson-eeclk.c +++ b/drivers/clk/meson/meson-eeclk.c @@ -18,6 +18,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; @@ -26,7 +27,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 8f3b7a94a667..827e78fb16a8 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -3792,12 +3792,15 @@ 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; 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_err("failed to get HHI regmap - Trying obsolete regs\n"); return;