summaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorBryan Wu <bryan.wu@canonical.com>2012-07-03 07:04:32 +0200
committerBryan Wu <bryan.wu@canonical.com>2012-07-24 01:52:37 +0200
commit9813d74fa55fba7a974d66d452d1d699ee15073b (patch)
treed06b4a3af0c5fd2963f5b8e920c94dace023b486 /drivers/leds
parentleds: convert Atmel PWM LED driver to devm_kzalloc() (diff)
downloadlinux-9813d74fa55fba7a974d66d452d1d699ee15073b.tar.xz
linux-9813d74fa55fba7a974d66d452d1d699ee15073b.zip
leds: convert LP3944 LED driver to devm_kzalloc()
Cc: Antonio Ospite <ospite@studenti.unina.it> Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-lp3944.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/leds/leds-lp3944.c b/drivers/leds/leds-lp3944.c
index b8f9f0a5d431..c298f7d9f535 100644
--- a/drivers/leds/leds-lp3944.c
+++ b/drivers/leds/leds-lp3944.c
@@ -393,7 +393,8 @@ static int __devinit lp3944_probe(struct i2c_client *client,
return -ENODEV;
}
- data = kzalloc(sizeof(struct lp3944_data), GFP_KERNEL);
+ data = devm_kzalloc(&client->dev, sizeof(struct lp3944_data),
+ GFP_KERNEL);
if (!data)
return -ENOMEM;
@@ -403,10 +404,8 @@ static int __devinit lp3944_probe(struct i2c_client *client,
mutex_init(&data->lock);
err = lp3944_configure(client, data, lp3944_pdata);
- if (err < 0) {
- kfree(data);
+ if (err < 0)
return err;
- }
dev_info(&client->dev, "lp3944 enabled\n");
return 0;
@@ -431,8 +430,6 @@ static int __devexit lp3944_remove(struct i2c_client *client)
break;
}
- kfree(data);
-
return 0;
}