diff options
author | Bryan Wu <bryan.wu@canonical.com> | 2012-07-04 11:59:19 +0800 |
---|---|---|
committer | Bryan Wu <bryan.wu@canonical.com> | 2012-07-24 07:52:39 +0800 |
commit | 0f4630c90b2c00dfb005d239d8926ec310fd560a (patch) | |
tree | b3813c75642bb2d0e07a6dd8bc93b002871b9f02 | |
parent | 0a8d9d4a61d8c7d6ea00835c814a678ba488b8aa (diff) | |
download | op-kernel-dev-0f4630c90b2c00dfb005d239d8926ec310fd560a.zip op-kernel-dev-0f4630c90b2c00dfb005d239d8926ec310fd560a.tar.gz |
leds: convert PCA9532 LED driver to devm_kzalloc()
Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
-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 ceccab4..cee8a5b 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, { struct pca9532_data *data = i2c_get_clientdata(client); struct pca9532_platform_data *pca9532_pdata = client->dev.platform_data; - int err; if (!pca9532_pdata) return -EIO; @@ -458,7 +457,7 @@ static int pca9532_probe(struct i2c_client *client, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - data = kzalloc(sizeof(*data), GFP_KERNEL); + data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; @@ -469,11 +468,7 @@ static int pca9532_probe(struct i2c_client *client, data->client = client; mutex_init(&data->update_lock); - err = pca9532_configure(client, data, pca9532_pdata); - if (err) - kfree(data); - - return err; + return pca9532_configure(client, data, pca9532_pdata); } static int pca9532_remove(struct i2c_client *client) @@ -485,7 +480,6 @@ static int pca9532_remove(struct i2c_client *client) if (err) return err; - kfree(data); return 0; } |