Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | Subject | [PATCH] l4f00242t03: fix memory leaks in error handling | Date | Fri, 23 Apr 2010 17:56:53 +0800 | 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
| ![\](/images/icornerr.gif) |