diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-03-11 07:34:35 +0100 |
---|---|---|
committer | Anton Vorontsov <anton@enomsg.org> | 2013-04-01 08:25:38 +0200 |
commit | f3f66b3ea46237a0810d09279a38b5413aaf5d5e (patch) | |
tree | 3c39867e8d797fa7586e099ac0bf2b19f97f9cfb /drivers/power | |
parent | max8997_charger: Use devm_kzalloc() (diff) | |
download | linux-f3f66b3ea46237a0810d09279a38b5413aaf5d5e.tar.xz linux-f3f66b3ea46237a0810d09279a38b5413aaf5d5e.zip |
max8903_charger: Use devm_kzalloc()
Use devm_kzalloc() to make cleanup paths more simple.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/max8903_charger.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/power/max8903_charger.c b/drivers/power/max8903_charger.c index 14e2b96d93b0..08f0d7909b6b 100644 --- a/drivers/power/max8903_charger.c +++ b/drivers/power/max8903_charger.c @@ -189,7 +189,7 @@ static int max8903_probe(struct platform_device *pdev) int ta_in = 0; int usb_in = 0; - data = kzalloc(sizeof(struct max8903_data), GFP_KERNEL); + data = devm_kzalloc(dev, sizeof(struct max8903_data), GFP_KERNEL); if (data == NULL) { dev_err(dev, "Cannot allocate memory.\n"); return -ENOMEM; @@ -341,7 +341,6 @@ err_dc_irq: err_psy: power_supply_unregister(&data->psy); err: - kfree(data); return ret; } @@ -359,7 +358,6 @@ static int max8903_remove(struct platform_device *pdev) if (pdata->dc_valid) free_irq(gpio_to_irq(pdata->dok), data); power_supply_unregister(&data->psy); - kfree(data); } return 0; |