From patchwork Sat Oct 22 07:24:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7562 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106054wrr; Sat, 22 Oct 2022 01:36:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4VbWCNfxyuDfRG8Pja7eb5bsAGS5YpW3z2Fj4h/sgu7ltUlVyKtpxxQqYW/8fYVTkyQITV X-Received: by 2002:a17:902:eb8c:b0:186:7fb5:2143 with SMTP id q12-20020a170902eb8c00b001867fb52143mr5884724plg.30.1666427806448; Sat, 22 Oct 2022 01:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427806; cv=none; d=google.com; s=arc-20160816; b=kxbCXAjvyEc+QWlXsIB20QXBNvF1K40pPkcV3MRydaJu+o3aUp3fT8r8ck+FyUOrOk E0VecplPshRO0ZozUlN84XpFFJtpGPrbp8SpXlSzVMBq/HZ0PMyOC+ZJoRvPbDgF2o4Y 2g5lZzfEob0v0/xyVEZrC54lvdMskqaS7TSfa59f4VNH+fnH1ffCTMe55ZCrgeFkSq5+ go4Gk4I8zJ5i4NgVX7YDqshaMU7YU4aDV5b3hcb9MplupAZ06RFRD3kU+ZAPwLyRSWkx k/UNH4uoXo7YdhAA6YtZqxIzjP+ZgoKxq5tFd6PctEXnRi79wMwPj5y6WysA1FDTkGLa yUYg== 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=F5QDI+cErMa+Sr/BWtRcQobp1j8H2E8nTtvqtEZXSRWU0Zg/NvZ5gj1GcO58edeI9J uy5dxcavdMqKA+4fJET0M7n3RZixUjSlzVTocIuPCWxrFohoFZmBYYemwc+WjjQql1FQ DKXrj+LuKm3jME/OMiOn5pfqjvx1YhnpXJHaFSvdatJmYMEkl68XOZTPUEvhzHuw5UfT qYuoDvud45XUfa5nYpLCFiRIIk+xSQdMY+07ljrWK5e+13Bb2rY29XEGTRp9DEAgW9jO 97ch+F4By0mi8hCakuACBOtNWiRh07hpmn1MsW/pt80HGjOeLgo842L9x9R/Gbw4zl9l aseA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vor8+8fB; 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 d2-20020a170902654200b00179c5d02ba1si24579132pln.442.2022.10.22.01.36.29; Sat, 22 Oct 2022 01:36:46 -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=Vor8+8fB; 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 S233464AbiJVIVb (ORCPT + 99 others); Sat, 22 Oct 2022 04:21:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233833AbiJVITv (ORCPT ); Sat, 22 Oct 2022 04:19:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01B242DF463; Sat, 22 Oct 2022 00:58:19 -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 F0D5960AD7; Sat, 22 Oct 2022 07:51:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1F73C433D6; Sat, 22 Oct 2022 07:51:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425085; bh=OIJs8jEJDlE4X49d2dwxy8tysOIHP5M9KVrpH9pEbiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vor8+8fB2olDE800GsBcmmAESl54nD9AqezAayB1fp9vPEKp3cRdwD+JqxxiXQc6/ AYkpofKE2ZhDFwaKNKHb54fDouOK7QCGj4EnBDk+ixxQpnQN4untmZvQj0CbNFL16f f4T9GiTq+pvgVzuikKNQWuOWbZa2VKYs0jSd/4Vs= 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.19 384/717] clk: qoriq: Hold reference returned by of_get_parent() Date: Sat, 22 Oct 2022 09:24:23 +0200 Message-Id: <20221022072514.536010465@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.3 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?1747376203537368718?= X-GMAIL-MSGID: =?utf-8?q?1747376203537368718?= 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; }