Patchwork [2/3] omap : nand : fix omap2 module reinsertion

login
register
mail settings
Submitter Bryan DE FARIA
Date April 29, 2011, 10:31 a.m.
Message ID <1304073070-24526-3-git-send-email-bdefaria@adeneo-embedded.com>
Download mbox | patch
Permalink /patch/93415/
State New
Headers show

Comments

Bryan DE FARIA - April 29, 2011, 10:31 a.m.
When the module is removed, a reinsertion will fail with a -16 error.

Signed-off-by: Bryan DE FARIA <bdefaria@adeneo-embedded.com>
---
 drivers/mtd/nand/omap2.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
vimal singh - April 29, 2011, 3:54 p.m.
On Fri, Apr 29, 2011 at 4:01 PM, Bryan DE FARIA
<bdefaria@adeneo-embedded.com> wrote:
> When the module is removed, a reinsertion will fail with a -16 error.
>
> Signed-off-by: Bryan DE FARIA <bdefaria@adeneo-embedded.com>
> ---
>  drivers/mtd/nand/omap2.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
> index da9a351..eab51da 100644
> --- a/drivers/mtd/nand/omap2.c
> +++ b/drivers/mtd/nand/omap2.c
> @@ -1138,6 +1138,7 @@ static int omap_nand_remove(struct platform_device *pdev)
>
>        /* Release NAND device, its internal structures and partitions */
>        nand_release(&info->mtd);
> +       release_mem_region(info->phys_base, NAND_IO_SIZE);

I think using 'release_resource' would be better here. And you should
better do this after below 'iounmap' is done.

>        iounmap(info->nand.IO_ADDR_R);
>        kfree(&info->mtd);
>        return 0;
> --

Patch

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index da9a351..eab51da 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -1138,6 +1138,7 @@  static int omap_nand_remove(struct platform_device *pdev)
 
 	/* Release NAND device, its internal structures and partitions */
 	nand_release(&info->mtd);
+	release_mem_region(info->phys_base, NAND_IO_SIZE);
 	iounmap(info->nand.IO_ADDR_R);
 	kfree(&info->mtd);
 	return 0;