diff options
author | Bryan Wu <bryan.wu@canonical.com> | 2012-07-03 23:59:19 -0400 |
---|---|---|
committer | Bryan Wu <bryan.wu@canonical.com> | 2012-07-23 19:52:39 -0400 |
commit | 0f4630c90b2c00dfb005d239d8926ec310fd560a (patch) | |
tree | b3813c75642bb2d0e07a6dd8bc93b002871b9f02 /drivers/leds | |
parent | 0a8d9d4a61d8c7d6ea00835c814a678ba488b8aa (diff) |
leds: convert PCA9532 LED driver to devm_kzalloc()
Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/leds-pca9532.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c index ceccab44b5b8..cee8a5b483ac 100644 --- a/drivers/leds/leds-pca9532.c +++ b/drivers/leds/leds-pca9532.c | |||
@@ -449,7 +449,6 @@ static int pca9532_probe(struct i2c_client *client, | |||
449 | { | 449 | { |
450 | struct pca9532_data *data = i2c_get_clientdata(client); | 450 | struct pca9532_data *data = i2c_get_clientdata(client); |
451 | struct pca9532_platform_data *pca9532_pdata = client->dev.platform_data; | 451 | struct pca9532_platform_data *pca9532_pdata = client->dev.platform_data; |
452 | int err; | ||
453 | 452 | ||
454 | if (!pca9532_pdata) | 453 | if (!pca9532_pdata) |
455 | return -EIO; | 454 | return -EIO; |
@@ -458,7 +457,7 @@ static int pca9532_probe(struct i2c_client *client, | |||
458 | I2C_FUNC_SMBUS_BYTE_DATA)) | 457 | I2C_FUNC_SMBUS_BYTE_DATA)) |
459 | return -EIO; | 458 | return -EIO; |
460 | 459 | ||
461 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 460 | data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); |
462 | if (!data) | 461 | if (!data) |
463 | return -ENOMEM; | 462 | return -ENOMEM; |
464 | 463 | ||
@@ -469,11 +468,7 @@ static int pca9532_probe(struct i2c_client *client, | |||
469 | data->client = client; | 468 | data->client = client; |
470 | mutex_init(&data->update_lock); | 469 | mutex_init(&data->update_lock); |
471 | 470 | ||
472 | err = pca9532_configure(client, data, pca9532_pdata); | 471 | return pca9532_configure(client, data, pca9532_pdata); |
473 | if (err) | ||
474 | kfree(data); | ||
475 | |||
476 | return err; | ||
477 | } | 472 | } |
478 | 473 | ||
479 | static int pca9532_remove(struct i2c_client *client) | 474 | static int pca9532_remove(struct i2c_client *client) |
@@ -485,7 +480,6 @@ static int pca9532_remove(struct i2c_client *client) | |||
485 | if (err) | 480 | if (err) |
486 | return err; | 481 | return err; |
487 | 482 | ||
488 | kfree(data); | ||
489 | return 0; | 483 | return 0; |
490 | } | 484 | } |
491 | 485 | ||