From patchwork Wed Oct 19 08:29:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5122 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251303wrs; Wed, 19 Oct 2022 03:51:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79Y5P+TTJKtUIpB2+N3mOB31BBY9U9OpE0BhyYs892bDVRth+hzTmOStKq4AgHAXjiAsOr X-Received: by 2002:a50:fb0f:0:b0:458:df03:c3aa with SMTP id d15-20020a50fb0f000000b00458df03c3aamr6678500edq.83.1666176684502; Wed, 19 Oct 2022 03:51:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176684; cv=none; d=google.com; s=arc-20160816; b=AGN1jFceK5bYFNbu/CnuMGRPoOnl57vqFrojjsgZ14FSZGnF8oDrlEZg00m989Qh9S NMyo3BWnl7ZWlHFgFM8d0DkChYokKtHAwS++faT48r6/hQn0zJqf2uAA4gMDF1u4kQhD ETJqZJo1q9KOarLQXIpmsyfjqBPCOp8TSpL0pDwLWTWECfiqyuVAImJEh8MDhG6xuZKF NzmZJOeJq+Q5Y0LcSIWTAtId7F0lRVa2XD472nyRcRyi5JTaksDgHfEGeK5u2c8PF2Yo KCSVpzHwnJhDrXYrzLJGk7M7QLDP5h3uJWCwKCsU38+KgoSOzfRAr4XjN2Y1EadeaI+h vQig== 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=sa80NSPQSaH4bfWbBGrqekGf6W5J0b4651s/9jV0G48=; b=umbq8TUxny/EKw5TNgkGnKw+4mKwTPyI/W0ffaevrN7MqiBHh1aj/Z+NMo2Ug2L4MF FwicU9clSHpX5oBj5Uyp4WG0GGzm7iWpA9/f/KqpWfJzfLKJLnqK2n1IJzSvAc+8hM8Q keEk5NRni9VTLjjGaw0y0O6CPz+Ddsf4sLfT2et1EodH72KMplibRVmAvD9wRWGKj+cW Pc6uJ/u9xeQYF4wBq1zVEKa+RcRvet191DWpxzFwWj4ve9QzHbdb8vsZKo+60vQ0VYRe OFOp+UkhUfb5Vejafv1oiUJnBqmH77yg/0j0/LY+o1ITrcvylRKvvcprMPYOyHldzL5/ FWiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wVvvzOBN; 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 u3-20020a50eac3000000b0045166555fddsi11747368edp.481.2022.10.19.03.50.59; Wed, 19 Oct 2022 03:51:24 -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=wVvvzOBN; 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 S233707AbiJSKuL (ORCPT + 99 others); Wed, 19 Oct 2022 06:50:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233864AbiJSKrq (ORCPT ); Wed, 19 Oct 2022 06:47:46 -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 1AD651187A5; Wed, 19 Oct 2022 03:21:40 -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 36879B8243F; Wed, 19 Oct 2022 08:59:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EEA3C433C1; Wed, 19 Oct 2022 08:59:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169953; bh=OIJs8jEJDlE4X49d2dwxy8tysOIHP5M9KVrpH9pEbiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wVvvzOBNQSnweW58/cFx7Ld1eHYn7++Sjjtg1rVrT1fONVjfaftoYXEUOP4iGqOfC cDBGMhzADzShvmAQ/kkuQ/OXva0wQLDjhu8Ez2GJ6GHQbPQR/rVneXRCU2fLpAeu7p Y8Korr/5I4dkaY/ce4lyNeOmk62hd8/bX/D+kgGQ= 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 6.0 471/862] clk: qoriq: Hold reference returned by of_get_parent() Date: Wed, 19 Oct 2022 10:29:18 +0200 Message-Id: <20221019083310.780397939@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?1747112882949382197?= X-GMAIL-MSGID: =?utf-8?q?1747112882949382197?= 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 88898b97a443..5eddb9f0d6bd 100644 --- a/drivers/clk/clk-qoriq.c +++ b/drivers/clk/clk-qoriq.c @@ -1063,8 +1063,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 */ @@ -1159,6 +1164,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; }