Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp878442rwi; Wed, 19 Oct 2022 04:13:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM750j+7mIoO1GIoq5V8V4nldKbYH4XPExkcCZVIolsnYzOdc4hX2BF1nhyPDlR4ds7t+Nzo X-Received: by 2002:a17:90b:4a04:b0:20c:37cf:6cc0 with SMTP id kk4-20020a17090b4a0400b0020c37cf6cc0mr44962840pjb.55.1666178001452; Wed, 19 Oct 2022 04:13:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178001; cv=none; d=google.com; s=arc-20160816; b=VvMYyVeQZ5lIgws6T6eYHtnKJt0eB5bIfy31upVQRfpKrHpTKmqmOmHG64oPxDZnhE 3al9P04ZypPw/w/twmX/Cl4uTurlNMo1HkuDAZI7VAtVF9aI9zX5+5zxJsImyha9acbi LzBXVDayFxtyKiNEaNEG4Y+eobLJwSgCprFidl4osGcw8e4SCdtMdJrabmVh21vfLd6m 9dGbps3kdmF/sWcotvAy57QeR0z7fdF4leqvQe0F8/MMO6kcC8MwbdJy0lYTZKEr6Mcf SpBG4vf1hvU/uwieBTT75NkcryVHx/gt3zADqtUqamJxWFyYca+chZwNm2r1clUtlnkx bzzQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d16-20020a056a0010d000b0053f52794b23si20240309pfu.88.2022.10.19.04.13.08; Wed, 19 Oct 2022 04:13:21 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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; } -- 2.35.1