lkml.org 
[lkml]   [2013]   [Nov]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] pwm: samsung: memory leak bugfix in pwm_samsung_free
Date
There is certainly a kind of memory leak since allocated data (i.e.
chip_data) is set NULL before freeing it by calling devm_kfree(). This
patch fixes the memory leak bug by modifying its call order.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
Reviewed-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
---
drivers/pwm/pwm-samsung.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
index fcc8b9a..07b2d9d 100644
--- a/drivers/pwm/pwm-samsung.c
+++ b/drivers/pwm/pwm-samsung.c
@@ -224,8 +224,8 @@ static int pwm_samsung_request(struct pwm_chip *chip, struct pwm_device *pwm)

static void pwm_samsung_free(struct pwm_chip *chip, struct pwm_device *pwm)
{
- pwm_set_chip_data(pwm, NULL);
devm_kfree(chip->dev, pwm_get_chip_data(pwm));
+ pwm_set_chip_data(pwm, NULL);
}

static int pwm_samsung_enable(struct pwm_chip *chip, struct pwm_device *pwm)
--
1.7.9.5


\
 
 \ /
  Last update: 2013-11-05 04:21    [W:0.024 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site