diff options
Diffstat (limited to 'drivers/leds/leds-lp3944.c')
-rw-r--r-- | drivers/leds/leds-lp3944.c | 9 |
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, | |||
393 | return -ENODEV; | 393 | return -ENODEV; |
394 | } | 394 | } |
395 | 395 | ||
396 | data = kzalloc(sizeof(struct lp3944_data), GFP_KERNEL); | 396 | data = devm_kzalloc(&client->dev, sizeof(struct lp3944_data), |
397 | GFP_KERNEL); | ||
397 | if (!data) | 398 | if (!data) |
398 | return -ENOMEM; | 399 | return -ENOMEM; |
399 | 400 | ||
@@ -403,10 +404,8 @@ static int __devinit lp3944_probe(struct i2c_client *client, | |||
403 | mutex_init(&data->lock); | 404 | mutex_init(&data->lock); |
404 | 405 | ||
405 | err = lp3944_configure(client, data, lp3944_pdata); | 406 | err = lp3944_configure(client, data, lp3944_pdata); |
406 | if (err < 0) { | 407 | if (err < 0) |
407 | kfree(data); | ||
408 | return err; | 408 | return err; |
409 | } | ||
410 | 409 | ||
411 | dev_info(&client->dev, "lp3944 enabled\n"); | 410 | dev_info(&client->dev, "lp3944 enabled\n"); |
412 | return 0; | 411 | return 0; |
@@ -431,8 +430,6 @@ static int __devexit lp3944_remove(struct i2c_client *client) | |||
431 | break; | 430 | break; |
432 | } | 431 | } |
433 | 432 | ||
434 | kfree(data); | ||
435 | |||
436 | return 0; | 433 | return 0; |
437 | } | 434 | } |
438 | 435 | ||