public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pwm: ab8500: use devm_kzalloc()
@ 2013-03-08  3:45 Jingoo Han
  2013-03-22 10:39 ` Thierry Reding
  0 siblings, 1 reply; 2+ messages in thread
From: Jingoo Han @ 2013-03-08  3:45 UTC (permalink / raw)
  To: 'Thierry Reding'; +Cc: linux-kernel, 'Jingoo Han'

Use devm_kzalloc() to make cleanup paths more simple.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/pwm/pwm-ab8500.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/pwm/pwm-ab8500.c b/drivers/pwm/pwm-ab8500.c
index 4248d04..93af1bb 100644
--- a/drivers/pwm/pwm-ab8500.c
+++ b/drivers/pwm/pwm-ab8500.c
@@ -99,7 +99,7 @@ static int ab8500_pwm_probe(struct platform_device *pdev)
 	 * Nothing to be done in probe, this is required to get the
 	 * device which is required for ab8500 read and write
 	 */
-	ab8500 = kzalloc(sizeof(*ab8500), GFP_KERNEL);
+	ab8500 = devm_kzalloc(&pdev->dev, sizeof(*ab8500), GFP_KERNEL);
 	if (ab8500 == NULL) {
 		dev_err(&pdev->dev, "failed to allocate memory\n");
 		return -ENOMEM;
@@ -111,10 +111,8 @@ static int ab8500_pwm_probe(struct platform_device *pdev)
 	ab8500->chip.npwm = 1;
 
 	err = pwmchip_add(&ab8500->chip);
-	if (err < 0) {
-		kfree(ab8500);
+	if (err < 0)
 		return err;
-	}
 
 	dev_dbg(&pdev->dev, "pwm probe successful\n");
 	platform_set_drvdata(pdev, ab8500);
@@ -132,7 +130,6 @@ static int ab8500_pwm_remove(struct platform_device *pdev)
 		return err;
 
 	dev_dbg(&pdev->dev, "pwm driver removed\n");
-	kfree(ab8500);
 
 	return 0;
 }
-- 
1.7.2.5



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

* Re: [PATCH] pwm: ab8500: use devm_kzalloc()
  2013-03-08  3:45 [PATCH] pwm: ab8500: use devm_kzalloc() Jingoo Han
@ 2013-03-22 10:39 ` Thierry Reding
  0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2013-03-22 10:39 UTC (permalink / raw)
  To: Jingoo Han; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 308 bytes --]

On Fri, Mar 08, 2013 at 12:45:58PM +0900, Jingoo Han wrote:
> Use devm_kzalloc() to make cleanup paths more simple.
> 
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> ---
>  drivers/pwm/pwm-ab8500.c |    7 ++-----
>  1 files changed, 2 insertions(+), 5 deletions(-)

Applied, thanks.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2013-03-22 10:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-08  3:45 [PATCH] pwm: ab8500: use devm_kzalloc() Jingoo Han
2013-03-22 10:39 ` Thierry Reding

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