From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Donghwa Lee <dh09.lee@samsung.com>,
Richard Purdie <rpurdie@rpsys.net>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] drivers/vidfeo/backlight: ld9040 cleanups
Date: Tue, 28 Jun 2011 21:45:04 +0800 [thread overview]
Message-ID: <1309268704.5925.2.camel@phoenix> (raw)
This patch includes below fixes:
1. Fix checking wrong return value for backlight_device_register.
2. Properly free allocated resources in ld9040_probe() error path
and ld9040_remove().
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/video/backlight/ld9040.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/video/backlight/ld9040.c b/drivers/video/backlight/ld9040.c
index 7281b25..62bcde3 100644
--- a/drivers/video/backlight/ld9040.c
+++ b/drivers/video/backlight/ld9040.c
@@ -701,9 +701,9 @@ static int ld9040_probe(struct spi_device *spi)
bd = backlight_device_register("ld9040-bl", &spi->dev,
lcd, &ld9040_backlight_ops, NULL);
- if (IS_ERR(ld)) {
- ret = PTR_ERR(ld);
- goto out_free_lcd;
+ if (IS_ERR(bd)) {
+ ret = PTR_ERR(bd);
+ goto out_unregister_lcd;
}
bd->props.max_brightness = MAX_BRIGHTNESS;
@@ -731,6 +731,8 @@ static int ld9040_probe(struct spi_device *spi)
dev_info(&spi->dev, "ld9040 panel driver has been probed.\n");
return 0;
+out_unregister_lcd:
+ lcd_device_unregister(lcd->ld);
out_free_lcd:
kfree(lcd);
return ret;
@@ -741,6 +743,7 @@ static int __devexit ld9040_remove(struct spi_device *spi)
struct ld9040 *lcd = dev_get_drvdata(&spi->dev);
ld9040_power(lcd, FB_BLANK_POWERDOWN);
+ backlight_device_unregister(lcd->bd);
lcd_device_unregister(lcd->ld);
kfree(lcd);
--
1.7.4.1
reply other threads:[~2011-06-28 13:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1309268704.5925.2.camel@phoenix \
--to=axel.lin@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dh09.lee@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rpurdie@rpsys.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.