Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2906639pxb; Mon, 18 Apr 2022 10:45:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMhmdkdRFzl1ztcbp5dYptZSynhquGFj/9PZIgosob+DLbUY8w5u8ZTGaQUGXhn+QOFSNq X-Received: by 2002:a17:902:b582:b0:14c:a63d:3df6 with SMTP id a2-20020a170902b58200b0014ca63d3df6mr11870436pls.51.1650303922026; Mon, 18 Apr 2022 10:45:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650303922; cv=none; d=google.com; s=arc-20160816; b=HVaelRPs/TN6Gdzn65+W6wZZ5h03WWX3JsJ5QPN9O9KOlh1TxgkWC1IKVTVe3cCRWA jq3Va7v09sZd3ZcSKstrVuHkSCTDO2QbvLCshLyCkmNmvxvAC08BLwuaUMjxcP/B5QNs y5MIs/g6+gYt1nGfikTM1Z6aClax6uasN/u0HKsQzUmZ4atH56N4vivYxpvx9vR7mhtg HTSOmeuwPrN8ZHvb3E28q0ae3EEAJqt+KjI/6y8lwvoquHH/quark5WgFsQJBJbymDOQ 6Zbf+8yG+X/Ybe5ZZqdtuGszzVVuZ3ZJl9igX2SunZsDbWkXT+BBlLipirU4utL+5lAU fhxg== 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=ut26o4yjeajb3vaRcP8wRQURTyiSkFm7mOhy+m1uq9s=; b=fBWigFrdQ6YfJJP1vc73yfuCzZuR+d6FpYqZx4ogWoBhSX2gQotCZEMAN3WyTu81CT De0UNwcvlmGFeP6IwHEgqe3ACLlknbWqT987wRQ4XR1HnZl4RCAncqEC9Xnfgbcjgt38 t6GXon+BubgMYXatUb1qZ2JmIO0JmVYb9+bvdhMaq3YdXm/1sLli8plFA5xKwvrJ9TWL uXc9991BL5C1m3SdK9QU/Rex5nih/S3s8FJqfNKhDhB36C7d05qBEK9iR/qMLdhNAKZa 1diHPBPS2KGuqU25DC+dB2C+qB1RxwggDODA2Rm3W9atlrIRxlKaoNMoa5yrtHP66qLW sf3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gtmM5SB0; 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 w4-20020a170902e88400b00158f13b4872si4543615plg.7.2022.04.18.10.45.05; Mon, 18 Apr 2022 10:45:22 -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=gtmM5SB0; 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 S237710AbiDRMYF (ORCPT + 99 others); Mon, 18 Apr 2022 08:24:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238646AbiDRMWl (ORCPT ); Mon, 18 Apr 2022 08:22:41 -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 E2D231EAE7; Mon, 18 Apr 2022 05:17:59 -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 03A5060F39; Mon, 18 Apr 2022 12:17:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D56FBC385A8; Mon, 18 Apr 2022 12:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650284278; bh=tv4zKBl+I3vxx2xHCn4Ct8zhqbx9Pth5UP2RUme5oVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gtmM5SB0MyCPXXO7rbSgqhK383kpGlrsaT22nNwSkwp0zGCpNjWT1ZCXWok1e2/GA tcExNSfq0A33TvtYI8MxzSSfxD8Uj3kA4ZEWhn4tThZhT3L3mX20+uqTEmgReV/qgF 0Zqf9KR/+zS7bR2mSatj+RVdTZ1zsnXS9k2LkkqY= 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 5.17 061/219] memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe Date: Mon, 18 Apr 2022 14:10:30 +0200 Message-Id: <20220418121207.176081250@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121203.462784814@linuxfoundation.org> References: <20220418121203.462784814@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 c267283b01fd..e749dcb3ddea 100644 --- a/drivers/memory/atmel-ebi.c +++ b/drivers/memory/atmel-ebi.c @@ -544,20 +544,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; @@ -608,6 +615,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