From patchwork Mon Oct 24 11:29:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9604 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp529626wru; Mon, 24 Oct 2022 09:03:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7x8W07dFFPbs9TapWahIp3Qvw8gbYYFUHOQXbJ5bY4+E/SAXgwNr20G6yfIjcRxbN/4J69 X-Received: by 2002:a17:907:3f96:b0:7ab:34aa:9094 with SMTP id hr22-20020a1709073f9600b007ab34aa9094mr1071527ejc.85.1666627434939; Mon, 24 Oct 2022 09:03:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627434; cv=none; d=google.com; s=arc-20160816; b=ypmHEYsAa8MUqaAH+CqZ8z9shzajSdDi+kEoWXVPpMOwMIvFSsJH7ErTRj6NNmalWm XIpCwU7Kf6Ru9Z1+KeaGSXdlb7SLnNcRCkO7jrOkugU3wwqDE0vlenu4v4Sf4XWwqleU xDgI48AHwZaFhaSv5DpNv1pjwEQ51IodmZGEzeAXlzV2HyZQYdcP57j6MguFXyd677r9 AIDZ5Yg6i+4sG4uetG9JrH2WG6Lsue7zC8vAkzJnF7anYyMQqk9oQ0VhExBXZFb+gDgq 9XVNyWbcPSqELzubfZ6eYyYsfoyvD9wXZNH9+++7HiwbJfpMl9VUeEDtoRKYUMr+OzV8 nJSw== 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=mLavZNKqVDoEjEFgmDk0e91XaGgO8/49pC07pdDteAc=; b=WAaxQ2iXezdqJJAWRY59HL+v2xA5mIAcYCSRzu7dlLuv8vxddKvYBEHGCY3J/zpupe K/aX0toS4xphQdzxrbWIoQSIp+8x/G6TaH3LBdTYdrCgFMCJmUxQNeuqWaDyJNVFIfmw 2Z7aU+dbVyG9qvCPNWGcS6o7uytncDsNTLAkICwY8uvL+K2EoquZDUDwUthAIv6Icnuj fuIBKepCinQBWcM349YCz/5oVCv/VPg3esYGjlOFSdNvaAkGEQHwyIpqDYAfCkHfFqbW iJYKI8TBxNCdmYruZNgZpJawQT6ISEJPQM7j7RxqmbT/Tqfhy45sy69l6UDkeQJt5KT4 hvkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jbFLjQxN; 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 w3-20020a1709067c8300b007a9fc5516f6si101145ejo.307.2022.10.24.09.03.23; Mon, 24 Oct 2022 09:03:54 -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=jbFLjQxN; 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 S232618AbiJXQCD (ORCPT + 99 others); Mon, 24 Oct 2022 12:02:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231224AbiJXP72 (ORCPT ); Mon, 24 Oct 2022 11:59:28 -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 0446F7C746; Mon, 24 Oct 2022 07:55:03 -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 85716B8161F; Mon, 24 Oct 2022 12:24:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0153C43470; Mon, 24 Oct 2022 12:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614271; bh=2UfDFvTBsGwHOUUmiH/Y0L6Lg35b+1hInQVnRyomgCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jbFLjQxN8vTj7kkrJiT9YOF2iA0ZM9ei7AMrouUhiIpWFaB1RO+M1q01o+G6+ItCf 4x5r+2TqhK8Su+3NR/3MDRLDFaeCAHqGXoIFhO7+RDjfj6+7U+epWXnRJqlWUMwGwx kXyL5+GrDyNAbGpxS6GFz00n5DEzhrG42O2yk0RM= 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 5.10 198/390] clk: qoriq: Hold reference returned by of_get_parent() Date: Mon, 24 Oct 2022 13:29:55 +0200 Message-Id: <20221024113031.213438217@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?1747585528952913596?= X-GMAIL-MSGID: =?utf-8?q?1747585528952913596?= From: Liang He [ Upstream commit a8ea4273bc26256ce3cce83164f0f51c5bf6e127 ] In legacy_init_clockgen(), we need to hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Beside, in create_sysclk(), we need to call of_node_put() on 'sysclk' also for refcount balance. Fixes: 0dfc86b3173f ("clk: qoriq: Move chip-specific knowledge into driver") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220628143851.171299-1-windhl@126.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/clk-qoriq.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c index 46101c6a20f2..585b9ac11881 100644 --- a/drivers/clk/clk-qoriq.c +++ b/drivers/clk/clk-qoriq.c @@ -1038,8 +1038,13 @@ static void __init _clockgen_init(struct device_node *np, bool legacy); */ static void __init legacy_init_clockgen(struct device_node *np) { - if (!clockgen.node) - _clockgen_init(of_get_parent(np), true); + if (!clockgen.node) { + struct device_node *parent_np; + + parent_np = of_get_parent(np); + _clockgen_init(parent_np, true); + of_node_put(parent_np); + } } /* Legacy node */ @@ -1134,6 +1139,7 @@ static struct clk * __init create_sysclk(const char *name) sysclk = of_get_child_by_name(clockgen.node, "sysclk"); if (sysclk) { clk = sysclk_from_fixed(sysclk, name); + of_node_put(sysclk); if (!IS_ERR(clk)) return clk; }