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:
Krzysztof Kozlowski 2020-08-26 16:48:57 +02:00 committed by Sebastian Reichel
parent 52a023a14e
commit 31873dc23c

View File

@ -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) {