LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] arm: Fix possible memory leak
@ 2011-01-30 19:26 Stefan Weil
  2011-01-31  5:01 ` Gulati, Shweta
  2011-01-31 16:20 ` Kevin Hilman
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Weil @ 2011-01-30 19:26 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Stefan Weil, Russell King, linux-omap, linux-arm-kernel, linux-kernel

sr_info was allocated and needs a kfree before returning.

This error was reported by cppcheck:
arch/arm/mach-omap2/smartreflex.c:837: error: Memory leak: sr_info

To: Tony Lindgren <tony@atomide.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: linux-omap@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 arch/arm/mach-omap2/smartreflex.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index af39d17..07324607 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -832,7 +832,8 @@ static int __init omap_sr_probe(struct platform_device *pdev)

 	if (!pdata) {
 		dev_err(&pdev->dev, "%s: platform data missing\n", __func__);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err_free_devinfo;
 	}

 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
--
1.7.2.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm: Fix possible memory leak
  2011-01-30 19:26 [PATCH] arm: Fix possible memory leak Stefan Weil
@ 2011-01-31  5:01 ` Gulati, Shweta
  2011-01-31 16:20 ` Kevin Hilman
  1 sibling, 0 replies; 3+ messages in thread
From: Gulati, Shweta @ 2011-01-31  5:01 UTC (permalink / raw)
  To: Stefan Weil
  Cc: Tony Lindgren, Russell King, linux-omap, linux-arm-kernel, linux-kernel

Acked. Will make sure there is no Memory Leak issue in Smartreflex Driver.

On Mon, Jan 31, 2011 at 12:56 AM, Stefan Weil <weil@mail.berlios.de> wrote:
> sr_info was allocated and needs a kfree before returning.
>
> This error was reported by cppcheck:
> arch/arm/mach-omap2/smartreflex.c:837: error: Memory leak: sr_info
>
> To: Tony Lindgren <tony@atomide.com>
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: linux-omap@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
> ---
>  arch/arm/mach-omap2/smartreflex.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
> index af39d17..07324607 100644
> --- a/arch/arm/mach-omap2/smartreflex.c
> +++ b/arch/arm/mach-omap2/smartreflex.c
> @@ -832,7 +832,8 @@ static int __init omap_sr_probe(struct platform_device *pdev)
>
>        if (!pdata) {
>                dev_err(&pdev->dev, "%s: platform data missing\n", __func__);
> -               return -EINVAL;
> +               ret = -EINVAL;
> +               goto err_free_devinfo;
>        }
>
>        mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> --
> 1.7.2.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


-- 
Thanks,
Regards,
Shweta

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm: Fix possible memory leak
  2011-01-30 19:26 [PATCH] arm: Fix possible memory leak Stefan Weil
  2011-01-31  5:01 ` Gulati, Shweta
@ 2011-01-31 16:20 ` Kevin Hilman
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Hilman @ 2011-01-31 16:20 UTC (permalink / raw)
  To: Stefan Weil
  Cc: Tony Lindgren, Russell King, linux-omap, linux-arm-kernel, linux-kernel

Stefan Weil <weil@mail.berlios.de> writes:

> sr_info was allocated and needs a kfree before returning.
>
> This error was reported by cppcheck:
> arch/arm/mach-omap2/smartreflex.c:837: error: Memory leak: sr_info
>
> To: Tony Lindgren <tony@atomide.com>
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: linux-omap@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>

Thanks, will queue this for 2.6.38-rc in my pm-fixes branch.

Kevin

> ---
>  arch/arm/mach-omap2/smartreflex.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
> index af39d17..07324607 100644
> --- a/arch/arm/mach-omap2/smartreflex.c
> +++ b/arch/arm/mach-omap2/smartreflex.c
> @@ -832,7 +832,8 @@ static int __init omap_sr_probe(struct platform_device *pdev)
>
>  	if (!pdata) {
>  		dev_err(&pdev->dev, "%s: platform data missing\n", __func__);
> -		return -EINVAL;
> +		ret = -EINVAL;
> +		goto err_free_devinfo;
>  	}
>
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> --
> 1.7.2.3
>
> --
> 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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-01-31 16:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-30 19:26 [PATCH] arm: Fix possible memory leak Stefan Weil
2011-01-31  5:01 ` Gulati, Shweta
2011-01-31 16:20 ` Kevin Hilman

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).