From patchwork Wed Mar 9 11:01:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaoqian Lin X-Patchwork-Id: 12774925 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8699CC433F5 for ; Wed, 9 Mar 2022 11:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=OhnL4wI0GhCc37yC+zCNcCeqXsqLhmtsEgfE1Q5BmB8=; b=YNZEDFhIvXG9oE //SGNUSCK1pR7BGeyb6sZDHSvCn512wNCEM4A0f/1LHom9rkngp7g2BGNoYKXeb+k2ofO10htQ7cy RcTLe7+a3lmx/xfRjdFGdmQjpbHmUBNnfjKDSQyr4qcMb86D2cAJx8G4+AaNixu960BlDTADz/gUt Mgx4FtFJhI/Sh2ScWlAppR7LfsKI4tEilGtogTg4njTid86BiCMTRecOaym3eLguu9IRqL63rZx0R qz+SVXSZmQYeKPJ4DL/YzHTCUD9OFlv8hcCAX5SaV9yPOrmoDuYYv7eSlL/jYfNazvRCgOePsu6Pk HMA8gjqUafd7qEJa8gQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRu4u-008Dyn-S2; Wed, 09 Mar 2022 11:02:01 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRu4r-008DyH-Aj for linux-arm-kernel@lists.infradead.org; Wed, 09 Mar 2022 11:01:58 +0000 Received: by mail-pl1-x634.google.com with SMTP id z3so1619682plg.8 for ; Wed, 09 Mar 2022 03:01:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=uMENzkKdA+Cycwv2RjlL4eOHNjlYxkelbnza/x9xMCo=; b=CdBzhLNe15o3w4/whWA35PbLedYesspkw+62C75GegLfv48MdGSTZzJ5f4n9Pj0D5/ HP7fKPID8O3X0mTcRPAp2pNrJ5RE2fkTUYL1oKCMNExeToruK+4NOzyTmx07AVHqEhuH 8GvENlgSMuVyBK+U9+el48l0haURmJliLHPxImvHcipDKB40AQCV0vs0XUumVrOvLsfI /b5gVKeoxcXjZji+++pxj+w4UIVTRk1MljbuI91UZFuSK0dYXno+TFjxfYJFsbhtK5Sk 7TAB6YRzT/UMW/PRgNnHnSH9zYmYTtBvS1d3JtsLCsyl0idBNJsMpBbRwe8rtEOAqUry Z8ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=uMENzkKdA+Cycwv2RjlL4eOHNjlYxkelbnza/x9xMCo=; b=JkKMNUvm1CTY7jCy705BM1tXq4LCxNBVPG5g8hRDojVZ4lqnjroXKFEMgN+tgcZjwT nLWbVKx78SYQjmWMqCYNKanjutd+YHOOgv+dGV8CDSQpF/3hmakBDlxxtL2lc+2/zDkI qBxxZaqGh3cOk7P65Mg2eXzbHBXlnlKgcJfliRQ1S7WtZitcJFvxmMgyOJJrPLUJ/VB6 SfdGZVhCha8LdqyD+MrJV/lCsgdUIN2BImuWQFtmtalwmMr+2Irepc9rXYmELzfaUnl/ X/kyFwEq8LWOaJik0qkqJnlHIG3+q6NpPos9GmZNUMJF7L1KpB482/1Ytm87y/o9uscs b1Qg== X-Gm-Message-State: AOAM531NKSNnQ810NF/ihLrRZpRzx8LM0Mw8g6UZtZOPxH2leyl08M/H E4ax91kQ1pWnC1+vhy1V0SQ= X-Google-Smtp-Source: ABdhPJxFXuDe2A9f+ayjVCidSoPzQQfMM66scU+hQ84B+zGrg4zQ9oAYeJY2KTKrt2zNb50p2WWdNg== X-Received: by 2002:a17:902:ea0d:b0:151:df90:779f with SMTP id s13-20020a170902ea0d00b00151df90779fmr17772260plg.1.1646823715498; Wed, 09 Mar 2022 03:01:55 -0800 (PST) Received: from localhost.localdomain ([159.226.95.43]) by smtp.googlemail.com with ESMTPSA id nm14-20020a17090b19ce00b001bf2404fd9dsm2197382pjb.31.2022.03.09.03.01.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Mar 2022 03:01:55 -0800 (PST) From: Miaoqian Lin To: Krzysztof Kozlowski , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Boris Brezillon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: linmq006@gmail.com Subject: [PATCH] memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe Date: Wed, 9 Mar 2022 11:01:43 +0000 Message-Id: <20220309110144.22412-1-linmq006@gmail.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220309_030157_416751_1698F7A0 X-CRM114-Status: GOOD ( 14.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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)