power: supply: ingenic: Simplify with dev_err_probe()
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
parent
52a023a14e
commit
31873dc23c
@ -147,11 +147,9 @@ static int ingenic_battery_probe(struct platform_device *pdev)
|
||||
psy_cfg.of_node = dev->of_node;
|
||||
|
||||
bat->battery = devm_power_supply_register(dev, desc, &psy_cfg);
|
||||
if (IS_ERR(bat->battery)) {
|
||||
if (PTR_ERR(bat->battery) != -EPROBE_DEFER)
|
||||
dev_err(dev, "Unable to register battery\n");
|
||||
return PTR_ERR(bat->battery);
|
||||
}
|
||||
if (IS_ERR(bat->battery))
|
||||
return dev_err_probe(dev, PTR_ERR(bat->battery),
|
||||
"Unable to register battery\n");
|
||||
|
||||
ret = power_supply_get_battery_info(bat->battery, &bat->info);
|
||||
if (ret) {
|
||||
|
Loading…
Reference in New Issue
Block a user