提交 f3f66b3e 编写于 作者: J Jingoo Han 提交者: Anton Vorontsov

max8903_charger: Use devm_kzalloc()

Use devm_kzalloc() to make cleanup paths more simple.
Signed-off-by: NJingoo Han <jg1.han@samsung.com>
Signed-off-by: NAnton Vorontsov <anton@enomsg.org>
上级 d4a20f57
......@@ -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 @@ static int max8903_probe(struct platform_device *pdev)
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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册