lkml.org 
[lkml]   [2010]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] l4f00242t03: fix memory leaks in error handling
Date
From

1. It is not necessary to free priv if kzalloc fail.
2. priv should be freed if gpio_request for pdata->reset_gpio and pdata->data_enable_gpio fail.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Richard Purdie <rpurdie@linux.intel.com>
---
drivers/video/backlight/l4f00242t03.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c
index bcdb12c..05d32e3 100644
--- a/drivers/video/backlight/l4f00242t03.c
+++ b/drivers/video/backlight/l4f00242t03.c
@@ -126,7 +126,7 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)
if (priv == NULL) {
dev_err(&spi->dev, "No memory for this device.\n");
ret = -ENOMEM;
- goto err;
+ return ret;
}

dev_set_drvdata(&spi->dev, priv);
@@ -139,7 +139,7 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)
if (ret) {
dev_err(&spi->dev,
"Unable to get the lcd l4f00242t03 reset gpio.\n");
- return ret;
+ goto err;
}

ret = gpio_direction_output(pdata->reset_gpio, 1);
@@ -151,7 +151,7 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)
if (ret) {
dev_err(&spi->dev,
"Unable to get the lcd l4f00242t03 data en gpio.\n");
- return ret;
+ goto err2;
}

ret = gpio_direction_output(pdata->data_enable_gpio, 0);
--
1.5.4.3
\
 
 \ /
  Last update: 2010-04-23 12:15    [W:0.016 / U:1.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site