[PATCH 24/25] leds: convert Heartbeat LED trigger driver to devm_kzalloc()
From: Bryan Wu
Date: Wed Jul 04 2012 - 01:13:59 EST
Cc: Atsushi Nemoto <anemo@xxxxxxxxxxxxx>
Signed-off-by: Bryan Wu <bryan.wu@xxxxxxxxxxxxx>
---
drivers/leds/ledtrig-heartbeat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/leds/ledtrig-heartbeat.c b/drivers/leds/ledtrig-heartbeat.c
index d3039f2..5caa01b 100644
--- a/drivers/leds/ledtrig-heartbeat.c
+++ b/drivers/leds/ledtrig-heartbeat.c
@@ -75,7 +75,8 @@ static void heartbeat_trig_activate(struct led_classdev *led_cdev)
{
struct heartbeat_trig_data *heartbeat_data;
- heartbeat_data = kzalloc(sizeof(*heartbeat_data), GFP_KERNEL);
+ heartbeat_data = devm_kzalloc(led_cdev->dev, sizeof(*heartbeat_data),
+ GFP_KERNEL);
if (!heartbeat_data)
return;
@@ -93,7 +94,6 @@ static void heartbeat_trig_deactivate(struct led_classdev *led_cdev)
if (led_cdev->activated) {
del_timer_sync(&heartbeat_data->timer);
- kfree(heartbeat_data);
led_cdev->activated = false;
}
}
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/