diff options
author | Jingoo Han <jg1.han@samsung.com> | 2012-07-30 23:40:33 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-31 02:25:15 +0200 |
commit | f1b60d46b6f1274f1eacfc89ddbf7f6b63348196 (patch) | |
tree | 4e9881852ce067ebf6488039a957a278c21b4247 /drivers/video/backlight | |
parent | drivers/video/backlight/atmel-pwm-bl.c: use devm_ functions (diff) | |
download | linux-f1b60d46b6f1274f1eacfc89ddbf7f6b63348196.tar.xz linux-f1b60d46b6f1274f1eacfc89ddbf7f6b63348196.zip |
drivers/video/backlight/ot200_bl.c: 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: Christian Gmeiner <christian.gmeiner@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/video/backlight')
-rw-r--r-- | drivers/video/backlight/ot200_bl.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/video/backlight/ot200_bl.c b/drivers/video/backlight/ot200_bl.c index f519d55a294c..ef637ffc0799 100644 --- a/drivers/video/backlight/ot200_bl.c +++ b/drivers/video/backlight/ot200_bl.c @@ -97,10 +97,10 @@ static int ot200_backlight_probe(struct platform_device *pdev) goto error_mfgpt_alloc; } - data = kzalloc(sizeof(*data), GFP_KERNEL); + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); if (!data) { retval = -ENOMEM; - goto error_kzalloc; + goto error_devm_kzalloc; } /* setup gpio */ @@ -122,16 +122,14 @@ static int ot200_backlight_probe(struct platform_device *pdev) if (IS_ERR(bl)) { dev_err(&pdev->dev, "failed to register backlight\n"); retval = PTR_ERR(bl); - goto error_backlight_device_register; + goto error_devm_kzalloc; } platform_set_drvdata(pdev, bl); return 0; -error_backlight_device_register: - kfree(data); -error_kzalloc: +error_devm_kzalloc: cs5535_mfgpt_free_timer(pwm_timer); error_mfgpt_alloc: gpio_free(GPIO_DIMM); @@ -141,7 +139,6 @@ error_mfgpt_alloc: static int ot200_backlight_remove(struct platform_device *pdev) { struct backlight_device *bl = platform_get_drvdata(pdev); - struct ot200_backlight_data *data = bl_get_data(bl); backlight_device_unregister(bl); @@ -154,7 +151,6 @@ static int ot200_backlight_remove(struct platform_device *pdev) cs5535_mfgpt_free_timer(pwm_timer); gpio_free(GPIO_DIMM); - kfree(data); return 0; } |