From patchwork Mon Oct 24 11:29:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9174 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458083wru; Mon, 24 Oct 2022 06:37:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vAnVQaQip76POsHLj6OYmWdWQ2O/lMUs9NleP6xj0sLTIDw8qx8Q8moeDNrjmh5kK8yGM X-Received: by 2002:a17:902:c942:b0:180:3f94:2975 with SMTP id i2-20020a170902c94200b001803f942975mr33406834pla.50.1666618611633; Mon, 24 Oct 2022 06:36:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618611; cv=none; d=google.com; s=arc-20160816; b=bkZidGgEw4j4y4OKDLrN5IhxaPNfS6PXAXqfFLh4O2E+DvnPDONZdjDtfvZZmj0vQn lzCn8C6jSUw2bGtt/HicS92k+vQ3vh2tcoeN1OAaCbJsAqVv7s/yCyvX8Idz0hYyb9Md 4VFfLuccb6GmwS0hapmqEuPbHf6oWgRxVf+bZANbKS2GVZh2jclIqPbBHllyG+Z28TSl e1/TAHTUQfwdADGtKEud8smcPoXX0BereJHD/fX7dmJCu/QJbu6WibGEKnK/vP53HA0d 3//HVFlf0TN52J2vCFummKtAj5/w/Nds0s92Go/3oBrNoPHLYemmeScrPNSJgUewSmtt lC7Q== 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=eUkHvBttQaI6RxRBPfjIsjMYp6pz05z4rUI/rZUDaCc=; b=ayA+Ql1Zd5EIiwOQxbF3o5iTzcXqRDsy3eGerQznFXDwscg59DLo3vv5CBzu7MCZT4 ZtODrebe6hnBTzvtWmkOy1W0UqejLUY6ifYZ2lZEABZBr9y6okxvt25UGWQ/PeNTgXH8 1rKMKwZdRLTh/WjeRxFMohCethtaKjkNP2P176rm6ahsf2Odt38dK1rrTpBD5jLxZeM2 l6KzqscIa1U/Sjl3wcdu0SZB1nfnfU+wPx2sjA7Md3f5bXpDngkz7KTim73E+AbmVut+ zgYnmSkNDgXgZr6eIWHJEr1S4rZvU26cpkcCCeW8KjAYY3vbZPF9B1mMjeakkbU/csye wYUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xuuz4J9S; 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 oj17-20020a17090b4d9100b002132abf9ad6si1030814pjb.148.2022.10.24.06.36.15; Mon, 24 Oct 2022 06:36:51 -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=Xuuz4J9S; 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 S235851AbiJXNQE (ORCPT + 99 others); Mon, 24 Oct 2022 09:16:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236010AbiJXNO3 (ORCPT ); Mon, 24 Oct 2022 09:14:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF992558F6; Mon, 24 Oct 2022 05:25:20 -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 79983612DF; Mon, 24 Oct 2022 12:24:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BA06C433C1; Mon, 24 Oct 2022 12:24:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614273; bh=aMhgMqMGgRl1+zscEHQn3kdfGb1OaQRYRmBXmXDblFE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xuuz4J9SvyE18GpjJQZPFfjQreME7g+kOXum7ZuXKC7pem0EzXzV23yPb1IR7xh9v T7SW0c02HMSf4BteNd1mx5SRXLCvU4Q0q2AqBTBzSK6851FSokij74/2LTznNs2zDn RWIGbbEUIWgWojp11jcDXnbMF6SV9J9mhKwn6uE4= 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 199/390] clk: berlin: Add of_node_put() for of_get_parent() Date: Mon, 24 Oct 2022 13:29:56 +0200 Message-Id: <20221024113031.260034287@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?1747576277350375333?= X-GMAIL-MSGID: =?utf-8?q?1747576277350375333?= From: Liang He [ Upstream commit 37c381b812dcbfde9c3f1f3d3e75fdfc1b40d5bc ] In berlin2_clock_setup() and berlin2q_clock_setup(), we need to call of_node_put() for the reference returned by of_get_parent() which has increased the refcount. We should call *_put() in fail path or when it is not used anymore. Fixes: 26b3b6b959b2 ("clk: berlin: prepare simple-mfd conversion") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220708084900.311684-1-windhl@126.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/berlin/bg2.c | 5 ++++- drivers/clk/berlin/bg2q.c | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/clk/berlin/bg2.c b/drivers/clk/berlin/bg2.c index bccdfa00fd37..67a9edbba29c 100644 --- a/drivers/clk/berlin/bg2.c +++ b/drivers/clk/berlin/bg2.c @@ -500,12 +500,15 @@ static void __init berlin2_clock_setup(struct device_node *np) int n, ret; clk_data = kzalloc(struct_size(clk_data, hws, MAX_CLKS), GFP_KERNEL); - if (!clk_data) + if (!clk_data) { + of_node_put(parent_np); return; + } clk_data->num = MAX_CLKS; hws = clk_data->hws; gbase = of_iomap(parent_np, 0); + of_node_put(parent_np); if (!gbase) return; diff --git a/drivers/clk/berlin/bg2q.c b/drivers/clk/berlin/bg2q.c index e9518d35f262..dd2784bb75b6 100644 --- a/drivers/clk/berlin/bg2q.c +++ b/drivers/clk/berlin/bg2q.c @@ -286,19 +286,23 @@ static void __init berlin2q_clock_setup(struct device_node *np) int n, ret; clk_data = kzalloc(struct_size(clk_data, hws, MAX_CLKS), GFP_KERNEL); - if (!clk_data) + if (!clk_data) { + of_node_put(parent_np); return; + } clk_data->num = MAX_CLKS; hws = clk_data->hws; gbase = of_iomap(parent_np, 0); if (!gbase) { + of_node_put(parent_np); pr_err("%pOF: Unable to map global base\n", np); return; } /* BG2Q CPU PLL is not part of global registers */ cpupll_base = of_iomap(parent_np, 1); + of_node_put(parent_np); if (!cpupll_base) { pr_err("%pOF: Unable to map cpupll base\n", np); iounmap(gbase);