]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drivers/video/backlight/atmel-pwm-bl.c: use devm_ functions
authorJingoo Han <jg1.han@samsung.com>
Sat, 21 Jul 2012 00:54:47 +0000 (10:54 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 25 Jul 2012 03:53:15 +0000 (13:53 +1000)
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>
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/video/backlight/atmel-pwm-bl.c

index 0443a4f718580c4381acf7d5cb538e941b7e2aa5..cd64073d3f534e3341405f4083c17dc109fd7430 100644 (file)
@@ -127,7 +127,8 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)
        struct atmel_pwm_bl *pwmbl;
        int retval;
 
-       pwmbl = kzalloc(sizeof(struct atmel_pwm_bl), GFP_KERNEL);
+       pwmbl = devm_kzalloc(&pdev->dev, sizeof(struct atmel_pwm_bl),
+                               GFP_KERNEL);
        if (!pwmbl)
                return -ENOMEM;
 
@@ -202,7 +203,6 @@ err_free_gpio:
 err_free_pwm:
        pwm_channel_free(&pwmbl->pwmc);
 err_free_mem:
-       kfree(pwmbl);
        return retval;
 }
 
@@ -218,7 +218,6 @@ static int __exit atmel_pwm_bl_remove(struct platform_device *pdev)
        pwm_channel_free(&pwmbl->pwmc);
        backlight_device_unregister(pwmbl->bldev);
        platform_set_drvdata(pdev, NULL);
-       kfree(pwmbl);
 
        return 0;
 }