diff options
author | Jingoo Han <jg1.han@samsung.com> | 2012-05-29 15:07:25 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-29 16:22:31 -0700 |
commit | c8515294a31ec63536eb1a2ba7a38797435dda4f (patch) | |
tree | a9728f32513a5131ab4ae1e1c0e47be6a6e244dd /drivers | |
parent | f072c8900c11bc91eb3fa9287bab4ce606632be5 (diff) |
backlight: tosa_lcd: 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: Dmitry Baryshkov <dbaryshkov@gmail.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')
-rw-r--r-- | drivers/video/backlight/tosa_lcd.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c index 2231aec23918..47823b8efff0 100644 --- a/drivers/video/backlight/tosa_lcd.c +++ b/drivers/video/backlight/tosa_lcd.c @@ -174,7 +174,8 @@ static int __devinit tosa_lcd_probe(struct spi_device *spi) int ret; struct tosa_lcd_data *data; - data = kzalloc(sizeof(struct tosa_lcd_data), GFP_KERNEL); + data = devm_kzalloc(&spi->dev, sizeof(struct tosa_lcd_data), + GFP_KERNEL); if (!data) return -ENOMEM; @@ -187,7 +188,7 @@ static int __devinit tosa_lcd_probe(struct spi_device *spi) ret = spi_setup(spi); if (ret < 0) - goto err_spi; + return ret; data->spi = spi; dev_set_drvdata(&spi->dev, data); @@ -224,8 +225,6 @@ err_gpio_dir: gpio_free(TOSA_GPIO_TG_ON); err_gpio_tg: dev_set_drvdata(&spi->dev, NULL); -err_spi: - kfree(data); return ret; } @@ -242,7 +241,6 @@ static int __devexit tosa_lcd_remove(struct spi_device *spi) gpio_free(TOSA_GPIO_TG_ON); dev_set_drvdata(&spi->dev, NULL); - kfree(data); return 0; } |