Patchwork [1/1] mtd/spear_smi: release memory region during remove

login
register
mail settings
Submitter Stefan Roese
Date Jan. 20, 2012, 10:35 a.m.
Message ID <1327055719-17644-1-git-send-email-sr@denx.de>
Download mbox | patch
Permalink /patch/136996/
State Accepted
Commit 495c47d799d93ad688db9db170200eb71525ff45
Headers show

Comments

Stefan Roese - Jan. 20, 2012, 10:35 a.m.
From: Shiraz Hashim <shiraz.hashim@st.com>

Driver must cleanup all held resources during remove. It wasn't
releasing requested memory region.

Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com>
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
---
Artem, this patch is a recent fixup to the new SMI driver,
thats now sitting in your l2-mtd and linux-next git repo.

Stefan

 drivers/mtd/devices/spear_smi.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
Artem Bityutskiy - Jan. 27, 2012, 2:01 p.m.
On Fri, 2012-01-20 at 11:35 +0100, Stefan Roese wrote:
> From: Shiraz Hashim <shiraz.hashim@st.com>
> 
> Driver must cleanup all held resources during remove. It wasn't
> releasing requested memory region.

Pushed to l2-mtd, thanks!

Patch

diff --git a/drivers/mtd/devices/spear_smi.c b/drivers/mtd/devices/spear_smi.c
index db4b741..fdc5f0b 100644
--- a/drivers/mtd/devices/spear_smi.c
+++ b/drivers/mtd/devices/spear_smi.c
@@ -1032,6 +1032,7 @@  static int __devexit spear_smi_remove(struct platform_device *pdev)
 {
 	struct spear_smi *dev;
 	struct spear_snor_flash *flash;
+	struct resource *smi_base;
 	int ret;
 	int i, irq;
 
@@ -1067,6 +1068,9 @@  static int __devexit spear_smi_remove(struct platform_device *pdev)
 	clk_put(dev->clk);
 	iounmap(dev->io_base);
 	kfree(dev);
+
+	smi_base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	release_mem_region(smi_base->start, resource_size(smi_base));
 	platform_set_drvdata(pdev, NULL);
 
 	return 0;