diff options
author | Axel Lin <axel.lin@gmail.com> | 2011-07-25 20:11:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-25 23:57:07 -0400 |
commit | e2e7da9bccd77ef6793b865c1b78c7e519ccc562 (patch) | |
tree | 1d8a4231b5020778a14784d707c0033bace26235 /drivers/video | |
parent | ccb6108f5b0b541d3eb332c3a73e645c0f84278e (diff) |
drivers/video/backlight/ld9040.c: small fixes
- Fix checking of wrong return value for backlight_device_register()
- Properly free allocated resources in ld9040_probe() error path and
ld9040_remove().
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Donghwa Lee <dh09.lee@samsung.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | 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 7281b2506a6..62bcde3c97f 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) | |||
701 | 701 | ||
702 | bd = backlight_device_register("ld9040-bl", &spi->dev, | 702 | bd = backlight_device_register("ld9040-bl", &spi->dev, |
703 | lcd, &ld9040_backlight_ops, NULL); | 703 | lcd, &ld9040_backlight_ops, NULL); |
704 | if (IS_ERR(ld)) { | 704 | if (IS_ERR(bd)) { |
705 | ret = PTR_ERR(ld); | 705 | ret = PTR_ERR(bd); |
706 | goto out_free_lcd; | 706 | goto out_unregister_lcd; |
707 | } | 707 | } |
708 | 708 | ||
709 | bd->props.max_brightness = MAX_BRIGHTNESS; | 709 | bd->props.max_brightness = MAX_BRIGHTNESS; |
@@ -731,6 +731,8 @@ static int ld9040_probe(struct spi_device *spi) | |||
731 | dev_info(&spi->dev, "ld9040 panel driver has been probed.\n"); | 731 | dev_info(&spi->dev, "ld9040 panel driver has been probed.\n"); |
732 | return 0; | 732 | return 0; |
733 | 733 | ||
734 | out_unregister_lcd: | ||
735 | lcd_device_unregister(lcd->ld); | ||
734 | out_free_lcd: | 736 | out_free_lcd: |
735 | kfree(lcd); | 737 | kfree(lcd); |
736 | return ret; | 738 | return ret; |
@@ -741,6 +743,7 @@ static int __devexit ld9040_remove(struct spi_device *spi) | |||
741 | struct ld9040 *lcd = dev_get_drvdata(&spi->dev); | 743 | struct ld9040 *lcd = dev_get_drvdata(&spi->dev); |
742 | 744 | ||
743 | ld9040_power(lcd, FB_BLANK_POWERDOWN); | 745 | ld9040_power(lcd, FB_BLANK_POWERDOWN); |
746 | backlight_device_unregister(lcd->bd); | ||
744 | lcd_device_unregister(lcd->ld); | 747 | lcd_device_unregister(lcd->ld); |
745 | kfree(lcd); | 748 | kfree(lcd); |
746 | 749 | ||