aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2010-05-03 14:42:44 +0800
committerRichard Purdie <rpurdie@linux.intel.com>2010-05-26 17:34:35 +0100
commitbeb0a43f398efac87a3b9c2c6a5c5a163df50413 (patch)
treed1be725605867375def6d0403d55716d87757055
parentee378a5c6550dcbfe6fa9c71b84ca2eb19cb288e (diff)
downloadkernel_samsung_smdk4412-beb0a43f398efac87a3b9c2c6a5c5a163df50413.tar.gz
kernel_samsung_smdk4412-beb0a43f398efac87a3b9c2c6a5c5a163df50413.tar.bz2
kernel_samsung_smdk4412-beb0a43f398efac87a3b9c2c6a5c5a163df50413.zip
backlight: l4f00242t03: fix error handling in l4f00242t03_probe
Error handling fixes: 1. In the case of kzalloc failure, simple return -ENOMEM instead of goto err. ( priv is NULL in this case ) 2. In the case of gpio_request fail for reset_gpio and data_enable_gpio, properly release resources by goto err and err2 respectively. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Alberto Panizzo <maramaopercheseimorto@gmail.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-rw-r--r--drivers/video/backlight/l4f00242t03.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c
index 1dafec85ddc..9093ef0fa86 100644
--- a/drivers/video/backlight/l4f00242t03.c
+++ b/drivers/video/backlight/l4f00242t03.c
@@ -125,8 +125,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 -ENOMEM;
}
dev_set_drvdata(&spi->dev, priv);
@@ -139,7 +138,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 +150,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);