Commit ab03e047 authored by Jingoo Han's avatar Jingoo Han Committed by Linus Torvalds

backlight: ltv350qv: 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: default avatarJingoo Han <jg1.han@samsung.com>
Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 26f2b35c
...@@ -232,23 +232,20 @@ static int __devinit ltv350qv_probe(struct spi_device *spi) ...@@ -232,23 +232,20 @@ static int __devinit ltv350qv_probe(struct spi_device *spi)
struct lcd_device *ld; struct lcd_device *ld;
int ret; int ret;
lcd = kzalloc(sizeof(struct ltv350qv), GFP_KERNEL); lcd = devm_kzalloc(&spi->dev, sizeof(struct ltv350qv), GFP_KERNEL);
if (!lcd) if (!lcd)
return -ENOMEM; return -ENOMEM;
lcd->spi = spi; lcd->spi = spi;
lcd->power = FB_BLANK_POWERDOWN; lcd->power = FB_BLANK_POWERDOWN;
lcd->buffer = kzalloc(8, GFP_KERNEL); lcd->buffer = devm_kzalloc(&spi->dev, 8, GFP_KERNEL);
if (!lcd->buffer) { if (!lcd->buffer)
ret = -ENOMEM; return -ENOMEM;
goto out_free_lcd;
}
ld = lcd_device_register("ltv350qv", &spi->dev, lcd, &ltv_ops); ld = lcd_device_register("ltv350qv", &spi->dev, lcd, &ltv_ops);
if (IS_ERR(ld)) { if (IS_ERR(ld))
ret = PTR_ERR(ld); return PTR_ERR(ld);
goto out_free_buffer;
}
lcd->ld = ld; lcd->ld = ld;
ret = ltv350qv_power(lcd, FB_BLANK_UNBLANK); ret = ltv350qv_power(lcd, FB_BLANK_UNBLANK);
...@@ -261,10 +258,6 @@ static int __devinit ltv350qv_probe(struct spi_device *spi) ...@@ -261,10 +258,6 @@ static int __devinit ltv350qv_probe(struct spi_device *spi)
out_unregister: out_unregister:
lcd_device_unregister(ld); lcd_device_unregister(ld);
out_free_buffer:
kfree(lcd->buffer);
out_free_lcd:
kfree(lcd);
return ret; return ret;
} }
...@@ -274,8 +267,6 @@ static int __devexit ltv350qv_remove(struct spi_device *spi) ...@@ -274,8 +267,6 @@ static int __devexit ltv350qv_remove(struct spi_device *spi)
ltv350qv_power(lcd, FB_BLANK_POWERDOWN); ltv350qv_power(lcd, FB_BLANK_POWERDOWN);
lcd_device_unregister(lcd->ld); lcd_device_unregister(lcd->ld);
kfree(lcd->buffer);
kfree(lcd);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment