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

rx51_battery: 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>
上级 3f8060a5
......@@ -202,7 +202,7 @@ static int rx51_battery_probe(struct platform_device *pdev)
struct rx51_device_info *di;
int ret;
di = kzalloc(sizeof(*di), GFP_KERNEL);
di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL);
if (!di)
return -ENOMEM;
......@@ -217,7 +217,6 @@ static int rx51_battery_probe(struct platform_device *pdev)
ret = power_supply_register(di->dev, &di->bat);
if (ret) {
platform_set_drvdata(pdev, NULL);
kfree(di);
return ret;
}
......@@ -230,7 +229,6 @@ static int rx51_battery_remove(struct platform_device *pdev)
power_supply_unregister(&di->bat);
platform_set_drvdata(pdev, NULL);
kfree(di);
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册