diff mbox

[1/2] mtd: pxa3xx_nand: fix a memory leak

Message ID 1307078050.4167.1.camel@phoenix
State Accepted
Commit 1a3591920e5100ba112a19e10a09ce7a5da1ab23
Headers show

Commit Message

Axel Lin June 3, 2011, 5:14 a.m. UTC
In pxa3xx_nand_remove, we should call nand_release instead of
mtd_device_unregister to properly free bad block table memory
and bad block descriptor memory.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/mtd/nand/pxa3xx_nand.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Daniel Mack June 3, 2011, 1:02 p.m. UTC | #1
(Cc Lei Wen)

On Fri, Jun 3, 2011 at 7:14 AM, Axel Lin <axel.lin@gmail.com> wrote:
> In pxa3xx_nand_remove, we should call nand_release instead of
> mtd_device_unregister to properly free bad block table memory
> and bad block descriptor memory.
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
>  drivers/mtd/nand/pxa3xx_nand.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
> index 1fb3b3a..f7040ea 100644
> --- a/drivers/mtd/nand/pxa3xx_nand.c
> +++ b/drivers/mtd/nand/pxa3xx_nand.c
> @@ -1119,7 +1119,7 @@ static int pxa3xx_nand_remove(struct platform_device *pdev)
>        clk_put(info->clk);
>
>        if (mtd) {
> -               mtd_device_unregister(mtd);
> +               nand_release(mtd);
>                kfree(mtd);
>        }
>        return 0;
> --
> 1.7.4.1
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
Lei Wen June 3, 2011, 3:58 p.m. UTC | #2
On Fri, Jun 3, 2011 at 9:02 PM, Daniel Mack <zonque@gmail.com> wrote:
> (Cc Lei Wen)
>
> On Fri, Jun 3, 2011 at 7:14 AM, Axel Lin <axel.lin@gmail.com> wrote:
>> In pxa3xx_nand_remove, we should call nand_release instead of
>> mtd_device_unregister to properly free bad block table memory
>> and bad block descriptor memory.
>>
>> Signed-off-by: Axel Lin <axel.lin@gmail.com>
>> ---
>>  drivers/mtd/nand/pxa3xx_nand.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
>> index 1fb3b3a..f7040ea 100644
>> --- a/drivers/mtd/nand/pxa3xx_nand.c
>> +++ b/drivers/mtd/nand/pxa3xx_nand.c
>> @@ -1119,7 +1119,7 @@ static int pxa3xx_nand_remove(struct platform_device *pdev)
>>        clk_put(info->clk);
>>
>>        if (mtd) {
>> -               mtd_device_unregister(mtd);
>> +               nand_release(mtd);
>>                kfree(mtd);
>>        }
>>        return 0;
>> --
>> 1.7.4.1
>>

Acked-by: Lei Wen <leiwen@marvell.com>
Artem Bityutskiy June 6, 2011, 10:19 a.m. UTC | #3
On Fri, 2011-06-03 at 13:14 +0800, Axel Lin wrote:
> In pxa3xx_nand_remove, we should call nand_release instead of
> mtd_device_unregister to properly free bad block table memory
> and bad block descriptor memory.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Pushed to l2-mtd-2.6.git, thanks!
diff mbox

Patch

diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index 1fb3b3a..f7040ea 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -1119,7 +1119,7 @@  static int pxa3xx_nand_remove(struct platform_device *pdev)
 	clk_put(info->clk);
 
 	if (mtd) {
-		mtd_device_unregister(mtd);
+		nand_release(mtd);
 		kfree(mtd);
 	}
 	return 0;