From patchwork Sat Oct 22 07:24:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7843 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1153695wrr; Sat, 22 Oct 2022 04:06:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76M0v2njfaSgPsEXSNX0djs9A/n3ODRlfsEnKVRAdgcGqPP4VtEaRMFj5+lrPbDVwP9qGQ X-Received: by 2002:a17:907:2bec:b0:78d:8bd0:61ee with SMTP id gv44-20020a1709072bec00b0078d8bd061eemr20173067ejc.669.1666436787398; Sat, 22 Oct 2022 04:06:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666436787; cv=none; d=google.com; s=arc-20160816; b=QEbrxpzISWW7f66GSYomoTmQXFsAELq1sZ8x3JA7WDE7/1R7uvk8w09PTEsCUEzNEm noHH14ifevrSijPxNWmoS9XHNOiL+hdQUwFYWoADU+Itchiu3IEnZlbS8JfHn+Q5FZXE V16EZuozO01hgRcWMmpnSkjb3COSKBLZNhq4MeqtpovIqOb15pGYmiALKOuCgxLlF2ZM hLTIcn/Qjf5lc/rI/hf0dLsww2Y8JTlcNvsC79ff0xGX4EENcplatUMyvphH4uIdOUGk Dddto5TvPtY1XcgPFrsyD5/+nqzXvaWrPzbaA6lE1yZFS+SrFH8F8YAa/VZ8AERvcG1Q 2rCw== 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=iDuRRgvDlyHVIeKwn4N+DPqAsiylXOOoWzR08iMCnUQz2ob/4haQTQRlnosF2hJik/ tFVtKXD9/3axcWOKx/xr4KVp5KTLOdUJsg1S+ff0KMklrobuNtQcizOtbV78iTvKzfwp 5fMu65D+t8KC6kSS+VzbNm6JxeXh1272wSiRPTMUVVk0mQXuEgiUo7J8SCzSyjoaiXVV FoH4KPXqfOayud13iIGb1qSMNxYw6QMsftCslB68GQMXNogujqB+BDfC02ps3O5KDY7n rc/MNJvVfWskq7PErvaFIjcxrNRACgPGKI5HYT3+HeG8Wc3oWEAXoyPv6iH09msE5HSY 0PWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2UPPkWEO; 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 q10-20020a170906678a00b0078da83673a3si19462617ejp.138.2022.10.22.04.06.02; Sat, 22 Oct 2022 04:06:27 -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=2UPPkWEO; 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 S230078AbiJVK7T (ORCPT + 99 others); Sat, 22 Oct 2022 06:59:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230494AbiJVK6m (ORCPT ); Sat, 22 Oct 2022 06:58:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 745CC2E9E34; Sat, 22 Oct 2022 03:17:17 -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 20181B82DF6; Sat, 22 Oct 2022 07:51:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25DC0C433C1; Sat, 22 Oct 2022 07:51:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425075; bh=iyKhAeS+fL/4paGpY198m4bprWGcYWFl+THorYYK8i8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2UPPkWEO/lWymHKNOq5sS423ER7qDfqzYWKgpiiYUyeHFhD7HbJ9t2L02NPMZlxBX CyPJOncFVBBmDrVVuVYjedTjNg2EoxLT5I2/F0vrxnxs8TNTl2YgvTzJCc5TDUe0OF Fw8YmwHHruvKgjXxFYLLtU5bTHBPRJWhQ5Xojsd8= 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.19 381/717] clk: meson: Hold reference returned by of_get_parent() Date: Sat, 22 Oct 2022 09:24:20 +0200 Message-Id: <20221022072514.134126867@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@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?1747385621030673001?= X-GMAIL-MSGID: =?utf-8?q?1747385621030673001?= 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;