Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3660125pxb; Tue, 19 Apr 2022 07:26:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCGLI6qRTBvuF6NeoT3/Xboze1e/Zf9MZ7eHHv6i/8tpP+0V/AfWFo46CL49NVeq199HX7 X-Received: by 2002:a17:907:c297:b0:6e8:b7dd:5bc1 with SMTP id tk23-20020a170907c29700b006e8b7dd5bc1mr14135639ejc.173.1650378417275; Tue, 19 Apr 2022 07:26:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650378417; cv=none; d=google.com; s=arc-20160816; b=VyXmQe5MWZg/eYPABbMmMD209U2nS1lUXbxAbY9Mo6y4ESQtnPDZXuBjTdcXui0NF7 uqU0LEfhSE48ixLGLOCQ7g2AlrbOXTnv/7q644QYI6cRovc/u3+Ix8ytxdzWzaNGD7QR 4DRTYnYaZOWlutmdatMn6L3s6HJjW2vbKLyzo+hrwB28jLL04DRbuGEkj/DWxevCd9IY 5xLBvwB/WIkHU8FxqeKLlWGRMdFeeJ6XkDNM6hrs9fTCrW+Xk1NuqIQsOCNyD5EkskVb dv/PFjhFwjrFR1xEpVhUJ4PGm5Hid0NSu1RdqQN6089nSgSu7Jif4axxot521I5esBdX 1iSQ== 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=qa+0m16KeO75/zO/Lwd7JeEf/BWMCevTy3q7QQbpJGU=; b=rMA4N40CBj4kO0sKCAsBgKCE7xSckHZOZ+qNauxTfT2Se0eFi1yxWf+FO5Jm74Xx8Z TrXZQcRzmfF5LzQ0zcX2BHwVlaqP+n1EeU3BLDJzKR+hg2iICbN02OzFd6SBEF3ZyxgN a0pb2O0scBSEo7z0+tQOETrDN8zGGKxApFZ4CumJm55Vg8ewJPjvzD/NZXU26f0Pe3p/ /NrScHRVvtYd7y7pffq5tYyKlwkK5AxnwkAwaG4hRS2sllySV1IvHCYyrOl4LGuu7FQK gP49jkvWQWaWh2OZa1xEy1OPvo19InLU5TttoP8TnPgcQBqiXTWQxmEXQitBWFgigAk4 Gr0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KbH0CF1u; 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 g5-20020aa7d1c5000000b00418dacea57fsi7940717edp.467.2022.04.19.07.26.33; Tue, 19 Apr 2022 07:26:57 -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=KbH0CF1u; 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 S245753AbiDROHq (ORCPT + 99 others); Mon, 18 Apr 2022 10:07:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244981AbiDRNvF (ORCPT ); Mon, 18 Apr 2022 09:51:05 -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 B7EE444A06; Mon, 18 Apr 2022 06:02:09 -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 5FA19B80E4B; Mon, 18 Apr 2022 13:02:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D6DCC385A8; Mon, 18 Apr 2022 13:02:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286927; bh=1e+kMqmuq0XgPzihm05kZ+rHyIgwe3Ceg9otdTGMBhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KbH0CF1ue9YS1wzx2Mqz3HoawYruPKouEI/MevVPbsTsFSnUXGz2bZBDcXv6iJEut PGZYQhN5X44IEu38PGEUog7E5DV9ja5Dys/XR1eqv8kJqoORvbfzuKYArA6/XIV8D6 C1b/o4KDkKYqKZfyAd3xGPi2vbbT/xw/1Gr76XBE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Claudiu Beznea , Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 4.14 261/284] memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe Date: Mon, 18 Apr 2022 14:14:02 +0200 Message-Id: <20220418121219.998650141@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121210.689577360@linuxfoundation.org> References: <20220418121210.689577360@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 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,T_SCC_BODY_TEXT_LINE 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: Miaoqian Lin [ Upstream commit 6f296a9665ba5ac68937bf11f96214eb9de81baa ] The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done. Fixes: 87108dc78eb8 ("memory: atmel-ebi: Enable the SMC clock if specified") Signed-off-by: Miaoqian Lin Reviewed-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220309110144.22412-1-linmq006@gmail.com Signed-off-by: Krzysztof Kozlowski Signed-off-by: Sasha Levin --- drivers/memory/atmel-ebi.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c index 2b9283d4fcb1..8e7b5a1d2983 100644 --- a/drivers/memory/atmel-ebi.c +++ b/drivers/memory/atmel-ebi.c @@ -524,20 +524,27 @@ static int atmel_ebi_probe(struct platform_device *pdev) smc_np = of_parse_phandle(dev->of_node, "atmel,smc", 0); ebi->smc.regmap = syscon_node_to_regmap(smc_np); - if (IS_ERR(ebi->smc.regmap)) - return PTR_ERR(ebi->smc.regmap); + if (IS_ERR(ebi->smc.regmap)) { + ret = PTR_ERR(ebi->smc.regmap); + goto put_node; + } ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np); - if (IS_ERR(ebi->smc.layout)) - return PTR_ERR(ebi->smc.layout); + if (IS_ERR(ebi->smc.layout)) { + ret = PTR_ERR(ebi->smc.layout); + goto put_node; + } ebi->smc.clk = of_clk_get(smc_np, 0); if (IS_ERR(ebi->smc.clk)) { - if (PTR_ERR(ebi->smc.clk) != -ENOENT) - return PTR_ERR(ebi->smc.clk); + if (PTR_ERR(ebi->smc.clk) != -ENOENT) { + ret = PTR_ERR(ebi->smc.clk); + goto put_node; + } ebi->smc.clk = NULL; } + of_node_put(smc_np); ret = clk_prepare_enable(ebi->smc.clk); if (ret) return ret; @@ -587,6 +594,10 @@ static int atmel_ebi_probe(struct platform_device *pdev) } return of_platform_populate(np, NULL, NULL, dev); + +put_node: + of_node_put(smc_np); + return ret; } static __maybe_unused int atmel_ebi_resume(struct device *dev) -- 2.35.1