Commit 0f4630c9 authored by Bryan Wu's avatar Bryan Wu

leds: convert PCA9532 LED driver to devm_kzalloc()

Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: default avatarBryan Wu <bryan.wu@canonical.com>
parent 0a8d9d4a
...@@ -449,7 +449,6 @@ static int pca9532_probe(struct i2c_client *client, ...@@ -449,7 +449,6 @@ static int pca9532_probe(struct i2c_client *client,
{ {
struct pca9532_data *data = i2c_get_clientdata(client); struct pca9532_data *data = i2c_get_clientdata(client);
struct pca9532_platform_data *pca9532_pdata = client->dev.platform_data; struct pca9532_platform_data *pca9532_pdata = client->dev.platform_data;
int err;
if (!pca9532_pdata) if (!pca9532_pdata)
return -EIO; return -EIO;
...@@ -458,7 +457,7 @@ static int pca9532_probe(struct i2c_client *client, ...@@ -458,7 +457,7 @@ static int pca9532_probe(struct i2c_client *client,
I2C_FUNC_SMBUS_BYTE_DATA)) I2C_FUNC_SMBUS_BYTE_DATA))
return -EIO; return -EIO;
data = kzalloc(sizeof(*data), GFP_KERNEL); data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
if (!data) if (!data)
return -ENOMEM; return -ENOMEM;
...@@ -469,11 +468,7 @@ static int pca9532_probe(struct i2c_client *client, ...@@ -469,11 +468,7 @@ static int pca9532_probe(struct i2c_client *client,
data->client = client; data->client = client;
mutex_init(&data->update_lock); mutex_init(&data->update_lock);
err = pca9532_configure(client, data, pca9532_pdata); return pca9532_configure(client, data, pca9532_pdata);
if (err)
kfree(data);
return err;
} }
static int pca9532_remove(struct i2c_client *client) static int pca9532_remove(struct i2c_client *client)
...@@ -485,7 +480,6 @@ static int pca9532_remove(struct i2c_client *client) ...@@ -485,7 +480,6 @@ static int pca9532_remove(struct i2c_client *client)
if (err) if (err)
return err; return err;
kfree(data);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment