* [PATCH] l4f00242t03: fix error handling in l4f00242t03_probe
@ 2010-05-03 6:42 Axel Lin
2010-05-03 8:06 ` Alberto Panizzo
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2010-05-03 6:42 UTC (permalink / raw)
To: linux-kernel; +Cc: Alberto Panizzo, ;Richard Purdie
This patch includes below fixes for properly error handling:
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>
---
drivers/video/backlight/l4f00242t03.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/video/backlight/l4f00242t03.c
b/drivers/video/backlight/l4f00242t03.c
index bcdb12c..a4632db 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);
--
1.5.4.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] l4f00242t03: fix error handling in l4f00242t03_probe
2010-05-03 6:42 [PATCH] l4f00242t03: fix error handling in l4f00242t03_probe Axel Lin
@ 2010-05-03 8:06 ` Alberto Panizzo
0 siblings, 0 replies; 2+ messages in thread
From: Alberto Panizzo @ 2010-05-03 8:06 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, ;Richard Purdie
On lun, 2010-05-03 at 14:42 +0800, Axel Lin wrote:
> This patch includes below fixes for properly error handling:
> 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>
Tank you for these fixes!
Acked-by: Alberto Panizzo <maramaopercheseimorto@gmail.com>
Alberto!
> ---
> drivers/video/backlight/l4f00242t03.c | 7 +++----
> 1 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/video/backlight/l4f00242t03.c
> b/drivers/video/backlight/l4f00242t03.c
> index bcdb12c..a4632db 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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-03 8:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-03 6:42 [PATCH] l4f00242t03: fix error handling in l4f00242t03_probe Axel Lin
2010-05-03 8:06 ` Alberto Panizzo
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).