Commit 9813d74f authored by Bryan Wu's avatar Bryan Wu

leds: convert LP3944 LED driver to devm_kzalloc()

Cc: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: default avatarBryan Wu <bryan.wu@canonical.com>
parent 4aad381f
...@@ -393,7 +393,8 @@ static int __devinit lp3944_probe(struct i2c_client *client, ...@@ -393,7 +393,8 @@ static int __devinit lp3944_probe(struct i2c_client *client,
return -ENODEV; return -ENODEV;
} }
data = kzalloc(sizeof(struct lp3944_data), GFP_KERNEL); data = devm_kzalloc(&client->dev, sizeof(struct lp3944_data),
GFP_KERNEL);
if (!data) if (!data)
return -ENOMEM; return -ENOMEM;
...@@ -403,10 +404,8 @@ static int __devinit lp3944_probe(struct i2c_client *client, ...@@ -403,10 +404,8 @@ static int __devinit lp3944_probe(struct i2c_client *client,
mutex_init(&data->lock); mutex_init(&data->lock);
err = lp3944_configure(client, data, lp3944_pdata); err = lp3944_configure(client, data, lp3944_pdata);
if (err < 0) { if (err < 0)
kfree(data);
return err; return err;
}
dev_info(&client->dev, "lp3944 enabled\n"); dev_info(&client->dev, "lp3944 enabled\n");
return 0; return 0;
...@@ -431,8 +430,6 @@ static int __devexit lp3944_remove(struct i2c_client *client) ...@@ -431,8 +430,6 @@ static int __devexit lp3944_remove(struct i2c_client *client)
break; break;
} }
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