aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2012-05-29 18:07:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-29 19:22:31 -0400
commit541f936f5d3993c5bbed33bdb53acd6de2403b04 (patch)
treee1bbd043cc8f966a16d135352d79d3b019fa42e9 /drivers/video
parentab03e04741fc7a5747daabc57d15cb1a3e2fd289 (diff)
backlight: s6e63m0: use devm_ functions
The devm_ functions allocate memory that is released when a driver detaches. This patch uses devm_kzalloc of these functions. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Cc: InKi Dae <inki.dae@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/s6e63m0.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/video/backlight/s6e63m0.c b/drivers/video/backlight/s6e63m0.c
index 3ed05c76856e..6437ae474cf2 100644
--- a/drivers/video/backlight/s6e63m0.c
+++ b/drivers/video/backlight/s6e63m0.c
@@ -741,7 +741,7 @@ static int __devinit s6e63m0_probe(struct spi_device *spi)
741 struct backlight_device *bd = NULL; 741 struct backlight_device *bd = NULL;
742 struct backlight_properties props; 742 struct backlight_properties props;
743 743
744 lcd = kzalloc(sizeof(struct s6e63m0), GFP_KERNEL); 744 lcd = devm_kzalloc(&spi->dev, sizeof(struct s6e63m0), GFP_KERNEL);
745 if (!lcd) 745 if (!lcd)
746 return -ENOMEM; 746 return -ENOMEM;
747 747
@@ -751,7 +751,7 @@ static int __devinit s6e63m0_probe(struct spi_device *spi)
751 ret = spi_setup(spi); 751 ret = spi_setup(spi);
752 if (ret < 0) { 752 if (ret < 0) {
753 dev_err(&spi->dev, "spi setup failed.\n"); 753 dev_err(&spi->dev, "spi setup failed.\n");
754 goto out_free_lcd; 754 return ret;
755 } 755 }
756 756
757 lcd->spi = spi; 757 lcd->spi = spi;
@@ -760,14 +760,12 @@ static int __devinit s6e63m0_probe(struct spi_device *spi)
760 lcd->lcd_pd = (struct lcd_platform_data *)spi->dev.platform_data; 760 lcd->lcd_pd = (struct lcd_platform_data *)spi->dev.platform_data;
761 if (!lcd->lcd_pd) { 761 if (!lcd->lcd_pd) {
762 dev_err(&spi->dev, "platform data is NULL.\n"); 762 dev_err(&spi->dev, "platform data is NULL.\n");
763 goto out_free_lcd; 763 return -EFAULT;
764 } 764 }
765 765
766 ld = lcd_device_register("s6e63m0", &spi->dev, lcd, &s6e63m0_lcd_ops); 766 ld = lcd_device_register("s6e63m0", &spi->dev, lcd, &s6e63m0_lcd_ops);
767 if (IS_ERR(ld)) { 767 if (IS_ERR(ld))
768 ret = PTR_ERR(ld); 768 return PTR_ERR(ld);
769 goto out_free_lcd;
770 }
771 769
772 lcd->ld = ld; 770 lcd->ld = ld;
773 771
@@ -824,8 +822,6 @@ static int __devinit s6e63m0_probe(struct spi_device *spi)
824 822
825out_lcd_unregister: 823out_lcd_unregister:
826 lcd_device_unregister(ld); 824 lcd_device_unregister(ld);
827out_free_lcd:
828 kfree(lcd);
829 return ret; 825 return ret;
830} 826}
831 827
@@ -838,7 +834,6 @@ static int __devexit s6e63m0_remove(struct spi_device *spi)
838 device_remove_file(&spi->dev, &dev_attr_gamma_mode); 834 device_remove_file(&spi->dev, &dev_attr_gamma_mode);
839 backlight_device_unregister(lcd->bd); 835 backlight_device_unregister(lcd->bd);
840 lcd_device_unregister(lcd->ld); 836 lcd_device_unregister(lcd->ld);
841 kfree(lcd);
842 837
843 return 0; 838 return 0;
844} 839}