Skip to content

Commit

Permalink
drivers/video/backlight/atmel-pwm-bl.c: use devm_ functions
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Jingoo Han authored and Linus Torvalds committed Jul 31, 2012
1 parent a824c73 commit a4be29a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/video/backlight/atmel-pwm-bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -202,7 +203,6 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)
err_free_pwm:
pwm_channel_free(&pwmbl->pwmc);
err_free_mem:
kfree(pwmbl);
return retval;
}

Expand All @@ -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;
}
Expand Down

0 comments on commit a4be29a

Please sign in to comment.