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

max8925_power: 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>
上级 bc67ea8e
......@@ -489,7 +489,8 @@ static int max8925_power_probe(struct platform_device *pdev)
return -EINVAL;
}
info = kzalloc(sizeof(struct max8925_power_info), GFP_KERNEL);
info = devm_kzalloc(&pdev->dev, sizeof(struct max8925_power_info),
GFP_KERNEL);
if (!info)
return -ENOMEM;
info->chip = chip;
......@@ -546,7 +547,6 @@ static int max8925_power_probe(struct platform_device *pdev)
out_usb:
power_supply_unregister(&info->ac);
out:
kfree(info);
return ret;
}
......@@ -559,7 +559,6 @@ static int max8925_power_remove(struct platform_device *pdev)
power_supply_unregister(&info->usb);
power_supply_unregister(&info->battery);
max8925_deinit_charger(info);
kfree(info);
}
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册