From patchwork Mon Oct 24 11:30:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9080 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445496wru; Mon, 24 Oct 2022 06:12:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7pzei7OJgIBQN+dNJNgMOaiAnoAeCbmZazySDfEvbfWxZemRJDsQGCDAZxeSLZ4aU9M7mG X-Received: by 2002:a63:4f09:0:b0:440:4706:2299 with SMTP id d9-20020a634f09000000b0044047062299mr28605173pgb.115.1666617162019; Mon, 24 Oct 2022 06:12:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617162; cv=none; d=google.com; s=arc-20160816; b=bTibQVdYDl3ksSg9B5qcIcQNsJN99ID7PInT945dgq0lxerUw7BWGgogOXEnVKVlHH VVpTDm3JwjGjyLzOv8txVEDMGLr/nTCK24HdJPgpaMuASct59t6UC7tkaSlX+n7Y5iI6 /MZLWWEQCXxLrEPAxIE3dOYWQWcvG4d2UeOkhTKbWnGeEyjPJ0bFn/85xBqS+bgcW/zO do/XsBlQqkJ98TVfwLVkXMRFKEFnWEfe6pMgKZg/2AFjetQIfOMUPg3sZdPCpa/a6dhC D9FNW1vuri3ZuY2KTRYzR8uvlNCSBqmn7n6KLZkEFmfBBQesfTEmmZgY1RygNFhlIDzT 8kgQ== 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=ILSjbA+b0tU0insuaq8u/tms5eGyaC+XlBcEjOrcvD0=; b=DK9Qll51vfIFnkD2G5yDO+EpgNyDY/otAbu5nEfkwerUHP7KHn5WFbP20pPp5e634s e5GPQTAmbTDJcbje3ctTLKDplZqDBg88iAszhkMbsFMewwTFVbALFAUToWkAQEVRnIYs V0TbODqNkcdB/D4zP6JT8gULNudcZ+29RowZO7uhk3tZhZRrzzwBTptl6JPeJkBXdbiF mJrOhEQLMjtYAw+Bhmb53LCRILAMFtnjo5NQbvIOhSJHEkP+j/9cRsgCCfMfZzZJF3gV 2npwejKOGQal/hsvn/EQVx6F/4EuHhqP4BDfdmapE0G9tzyadfipc2r31k+qC+lZSTyq l/Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xc2v6H3V; 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 h187-20020a636cc4000000b004396227b476si30257871pgc.774.2022.10.24.06.12.27; Mon, 24 Oct 2022 06:12:42 -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=Xc2v6H3V; 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 S235655AbiJXNMD (ORCPT + 99 others); Mon, 24 Oct 2022 09:12:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235822AbiJXNJo (ORCPT ); Mon, 24 Oct 2022 09:09:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F3D69F754; Mon, 24 Oct 2022 05:23:18 -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 D576E61268; Mon, 24 Oct 2022 12:11:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E781AC433C1; Mon, 24 Oct 2022 12:11:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613474; bh=ZV8yv8pgRgm0gpnXZ2O17bX3RzXcFDMTAtvPX2IT8zU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xc2v6H3VrRmkLmWOUw6ZLuhBgdDIgugJBUbIu8ncNIX7J4aY3easectCkPZisfVG3 ruVkPmHBU9msoemwBWb3A/jBnmzBTL09vmRaA7hlyBT3CBxL55S+XUKxh7UGVA4qeQ H5tvi9ZXhiUVIjmABNID5h6aqkYNPLfazTNk8mqE= 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.4 123/255] clk: meson: Hold reference returned by of_get_parent() Date: Mon, 24 Oct 2022 13:30:33 +0200 Message-Id: <20221024113006.638350032@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747574757488066493?= X-GMAIL-MSGID: =?utf-8?q?1747574757488066493?= 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 bf8bea675d24..6c7110a96194 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 082178a0f41a..efddf0d152a4 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -3684,13 +3684,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");