lkml.org 
[lkml]   [2012]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 21/25] leds: convert transient LED trigger driver to devm_kzalloc()
Date
Cc: Shuah Khan <shuahkhan@gmail.com>
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
---
drivers/leds/ledtrig-transient.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/leds/ledtrig-transient.c b/drivers/leds/ledtrig-transient.c
index 398f104..8e30b0df 100644
--- a/drivers/leds/ledtrig-transient.c
+++ b/drivers/leds/ledtrig-transient.c
@@ -161,7 +161,8 @@ static void transient_trig_activate(struct led_classdev *led_cdev)
int rc;
struct transient_trig_data *tdata;

- tdata = kzalloc(sizeof(struct transient_trig_data), GFP_KERNEL);
+ tdata = devm_kzalloc(led_cdev->dev,
+ sizeof(struct transient_trig_data), GFP_KERNEL);
if (!tdata) {
dev_err(led_cdev->dev,
"unable to allocate transient trigger\n");
@@ -194,7 +195,6 @@ err_out_duration:
err_out:
dev_err(led_cdev->dev, "unable to register transient trigger\n");
led_cdev->trigger_data = NULL;
- kfree(tdata);
}

static void transient_trig_deactivate(struct led_classdev *led_cdev)
@@ -209,7 +209,6 @@ static void transient_trig_deactivate(struct led_classdev *led_cdev)
device_remove_file(led_cdev->dev, &dev_attr_state);
led_cdev->trigger_data = NULL;
led_cdev->activated = false;
- kfree(transient_data);
}
}

--
1.7.10.4


\
 
 \ /
  Last update: 2012-07-04 08:21    [W:0.128 / U:0.532 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site