mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] backlight: atmel-pwm-bl: use devm_ functions
@ 2012-05-21  9:18 Jingoo Han
  2012-05-21 12:20 ` Hans-Christian Egtvedt
  0 siblings, 1 reply; 2+ messages in thread
From: Jingoo Han @ 2012-05-21  9:18 UTC (permalink / raw)
  To: 'Andrew Morton', 'LKML'
  Cc: 'Richard Purdie', 'Hans-Christian Egtvedt',
	'Jingoo Han'

The devm_ functions allocate memory that is released when a driver
detaches. This patch uses devm_kzalloc of these functions.

Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/video/backlight/atmel-pwm-bl.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c
index 0443a4f..cd64073 100644
--- a/drivers/video/backlight/atmel-pwm-bl.c
+++ b/drivers/video/backlight/atmel-pwm-bl.c
@@ -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;
 }
-- 
1.7.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/3] backlight: atmel-pwm-bl: use devm_ functions
  2012-05-21  9:18 [PATCH 1/3] backlight: atmel-pwm-bl: use devm_ functions Jingoo Han
@ 2012-05-21 12:20 ` Hans-Christian Egtvedt
  0 siblings, 0 replies; 2+ messages in thread
From: Hans-Christian Egtvedt @ 2012-05-21 12:20 UTC (permalink / raw)
  To: Jingoo Han
  Cc: 'Andrew Morton', 'LKML', 'Richard Purdie'

Around Mon 21 May 2012 18:18:36 +0900 or thereabout, Jingoo Han wrote:
> The devm_ functions allocate memory that is released when a driver
> detaches. This patch uses devm_kzalloc of these functions.

Looks good, thanks for the update.

> Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> Cc: Richard Purdie <rpurdie@rpsys.net>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>

Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>

<snipp diff>

-- 
mvh
Hans-Christian Egtvedt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-05-21 12:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-21  9:18 [PATCH 1/3] backlight: atmel-pwm-bl: use devm_ functions Jingoo Han
2012-05-21 12:20 ` Hans-Christian Egtvedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®