[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1AB93CE9C271144CA0E1E10487DA040806BC7D@MTCEXVS01.mitacad.com>
Date: Fri, 23 Apr 2010 17:56:53 +0800
From: <axel.lin@...ac.com.tw>
To: <linux-kernel@...r.kernel.org>
Cc: <rpurdie@...ux.intel.com>, <maramaopercheseimorto@...il.com>
Subject: [PATCH] l4f00242t03: fix memory leaks in error handling
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@...il.com>
Cc: Richard Purdie <rpurdie@...ux.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
Powered by blists - more mailing lists