diff options
author | Devendra Naga <devendra.aaru@gmail.com> | 2013-01-05 23:53:25 -0500 |
---|---|---|
committer | Anton Vorontsov <anton@enomsg.org> | 2013-01-06 14:18:58 -0800 |
commit | 00edfc65c2ce7d039ea45f1b3cc120db01ddcce9 (patch) | |
tree | 5ab89c67d3e96e5932ae073356d0b45defe34dcf /drivers/power/max17040_battery.c | |
parent | d5c2b14cb2b9b6a099e22f39ae2196a8403994e9 (diff) |
max17040_battery: Use devm_kzalloc
use devm_kzalloc and no need of error path and unload frees.
Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Diffstat (limited to 'drivers/power/max17040_battery.c')
-rw-r--r-- | drivers/power/max17040_battery.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/power/max17040_battery.c b/drivers/power/max17040_battery.c index 22cfe9cc472..74a0bd9bc16 100644 --- a/drivers/power/max17040_battery.c +++ b/drivers/power/max17040_battery.c @@ -207,7 +207,7 @@ static int max17040_probe(struct i2c_client *client, if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE)) return -EIO; - chip = kzalloc(sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); if (!chip) return -ENOMEM; @@ -225,7 +225,6 @@ static int max17040_probe(struct i2c_client *client, ret = power_supply_register(&client->dev, &chip->battery); if (ret) { dev_err(&client->dev, "failed: power supply register\n"); - kfree(chip); return ret; } @@ -244,7 +243,6 @@ static int max17040_remove(struct i2c_client *client) power_supply_unregister(&chip->battery); cancel_delayed_work(&chip->work); - kfree(chip); return 0; } |