linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yang Yingliang <yangyingliang@huawei.com>
To: <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>, <linux-imx@nxp.com>
Cc: <shawnguo@kernel.org>
Subject: [PATCH -next 1/2] ARM: imx: add missing iounmap() in imx_mmdc_remove()
Date: Mon, 24 May 2021 15:06:59 +0800	[thread overview]
Message-ID: <20210524070700.3032039-2-yangyingliang@huawei.com> (raw)
In-Reply-To: <20210524070700.3032039-1-yangyingliang@huawei.com>

mmdc_base need be unmapped in imx_mmdc_remove().

Fixes: e76bdfd7403a ("ARM: imx: Added perf functionality to mmdc driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 arch/arm/mach-imx/mmdc.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-imx/mmdc.c b/arch/arm/mach-imx/mmdc.c
index 0dfd0ae7a63d..c313eb1f614c 100644
--- a/arch/arm/mach-imx/mmdc.c
+++ b/arch/arm/mach-imx/mmdc.c
@@ -77,6 +77,8 @@ static const struct of_device_id imx_mmdc_dt_ids[] = {
 	{ /* sentinel */ }
 };
 
+static void __iomem *mmdc_base;
+
 #ifdef CONFIG_PERF_EVENTS
 
 static enum cpuhp_state cpuhp_mmdc_state;
@@ -456,16 +458,6 @@ static int mmdc_pmu_init(struct mmdc_pmu *pmu_mmdc,
 	return mmdc_num;
 }
 
-static int imx_mmdc_remove(struct platform_device *pdev)
-{
-	struct mmdc_pmu *pmu_mmdc = platform_get_drvdata(pdev);
-
-	cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node);
-	perf_pmu_unregister(&pmu_mmdc->pmu);
-	kfree(pmu_mmdc);
-	return 0;
-}
-
 static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_base)
 {
 	struct mmdc_pmu *pmu_mmdc;
@@ -528,14 +520,26 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b
 }
 
 #else
-#define imx_mmdc_remove NULL
 #define imx_mmdc_perf_init(pdev, mmdc_base) 0
 #endif
 
+static int imx_mmdc_remove(struct platform_device *pdev)
+{
+#ifdef CONFIG_PERF_EVENTS
+	struct mmdc_pmu *pmu_mmdc = platform_get_drvdata(pdev);
+
+	cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node);
+	perf_pmu_unregister(&pmu_mmdc->pmu);
+	kfree(pmu_mmdc);
+#endif
+	iounmap(mmdc_base);
+	return 0;
+}
+
 static int imx_mmdc_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
-	void __iomem *mmdc_base, *reg;
+	void *reg;
 	struct clk *mmdc_ipg_clk;
 	u32 val;
 	int err;
-- 
2.25.1


  reply	other threads:[~2021-05-24  7:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-24  7:06 [PATCH -next 0/2] ARM: imx: free resources in imx_mmdc_remove() Yang Yingliang
2021-05-24  7:06 ` Yang Yingliang [this message]
2021-06-12  2:31   ` [PATCH -next 1/2] ARM: imx: add missing iounmap() " Shawn Guo
2021-05-24  7:07 ` [PATCH -next 2/2] ARM: imx: add missing clk_disable_unprepare() " Yang Yingliang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210524070700.3032039-2-yangyingliang@huawei.com \
    --to=yangyingliang@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).