Patchwork pxa2xx-flash.c: fix memory leak

login
register
mail settings
Submitter Daniel Mack
Date March 24, 2009, 12:19 a.m.
Message ID <1237853943-6472-1-git-send-email-daniel@caiaq.de>
Download mbox | patch
Permalink /patch/24934/
State New, archived
Headers show

Comments

Daniel Mack - March 24, 2009, 12:19 a.m.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Nicolas Pitre <nico@cam.org>
---
 drivers/mtd/maps/pxa2xx-flash.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Nicolas Pitre - March 24, 2009, 12:22 a.m.
On Tue, 24 Mar 2009, Daniel Mack wrote:

> 
> Signed-off-by: Daniel Mack <daniel@caiaq.de>
> Cc: Nicolas Pitre <nico@cam.org>

Acked-by: Nicolas Pitre <nico@cam.org>


> ---
>  drivers/mtd/maps/pxa2xx-flash.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c
> index 771139c..9d66881 100644
> --- a/drivers/mtd/maps/pxa2xx-flash.c
> +++ b/drivers/mtd/maps/pxa2xx-flash.c
> @@ -70,6 +70,7 @@ static int __init pxa2xx_flash_probe(struct device *dev)
>  	if (!info->map.virt) {
>  		printk(KERN_WARNING "Failed to ioremap %s\n",
>  		       info->map.name);
> +		kfree(info);
>  		return -ENOMEM;
>  	}
>  	info->map.cached =
> @@ -92,6 +93,7 @@ static int __init pxa2xx_flash_probe(struct device *dev)
>  		iounmap((void *)info->map.virt);
>  		if (info->map.cached)
>  			iounmap(info->map.cached);
> +		kfree(info);
>  		return -EIO;
>  	}
>  	info->mtd->owner = THIS_MODULE;
> -- 
> 1.6.2
>
Daniel Mack - March 24, 2009, 12:31 a.m.
On Mon, Mar 23, 2009 at 08:22:26PM -0400, Nicolas Pitre wrote:
> > Signed-off-by: Daniel Mack <daniel@caiaq.de>
> > Cc: Nicolas Pitre <nico@cam.org>
> 
> Acked-by: Nicolas Pitre <nico@cam.org>

Thanks - any idea which channel to choose to make it go mainline?

Daniel
Nicolas Pitre - March 24, 2009, 12:51 a.m.
On Tue, 24 Mar 2009, Daniel Mack wrote:

> On Mon, Mar 23, 2009 at 08:22:26PM -0400, Nicolas Pitre wrote:
> > > Signed-off-by: Daniel Mack <daniel@caiaq.de>
> > > Cc: Nicolas Pitre <nico@cam.org>
> > 
> > Acked-by: Nicolas Pitre <nico@cam.org>
> 
> Thanks - any idea which channel to choose to make it go mainline?

The MTD tree.


Nicolas

Patch

diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c
index 771139c..9d66881 100644
--- a/drivers/mtd/maps/pxa2xx-flash.c
+++ b/drivers/mtd/maps/pxa2xx-flash.c
@@ -70,6 +70,7 @@  static int __init pxa2xx_flash_probe(struct device *dev)
 	if (!info->map.virt) {
 		printk(KERN_WARNING "Failed to ioremap %s\n",
 		       info->map.name);
+		kfree(info);
 		return -ENOMEM;
 	}
 	info->map.cached =
@@ -92,6 +93,7 @@  static int __init pxa2xx_flash_probe(struct device *dev)
 		iounmap((void *)info->map.virt);
 		if (info->map.cached)
 			iounmap(info->map.cached);
+		kfree(info);
 		return -EIO;
 	}
 	info->mtd->owner = THIS_MODULE;