forked from Minki/linux
power: supply: bq27xxx: 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
5ca937fb5d
commit
4024810c5a
@ -1992,13 +1992,9 @@ int bq27xxx_battery_setup(struct bq27xxx_device_info *di)
|
|||||||
psy_desc->external_power_changed = bq27xxx_external_power_changed;
|
psy_desc->external_power_changed = bq27xxx_external_power_changed;
|
||||||
|
|
||||||
di->bat = power_supply_register_no_ws(di->dev, psy_desc, &psy_cfg);
|
di->bat = power_supply_register_no_ws(di->dev, psy_desc, &psy_cfg);
|
||||||
if (IS_ERR(di->bat)) {
|
if (IS_ERR(di->bat))
|
||||||
if (PTR_ERR(di->bat) == -EPROBE_DEFER)
|
return dev_err_probe(di->dev, PTR_ERR(di->bat),
|
||||||
dev_dbg(di->dev, "failed to register battery, deferring probe\n");
|
"failed to register battery\n");
|
||||||
else
|
|
||||||
dev_err(di->dev, "failed to register battery\n");
|
|
||||||
return PTR_ERR(di->bat);
|
|
||||||
}
|
|
||||||
|
|
||||||
bq27xxx_battery_settings(di);
|
bq27xxx_battery_settings(di);
|
||||||
bq27xxx_battery_update(di);
|
bq27xxx_battery_update(di);
|
||||||
|
Loading…
Reference in New Issue
Block a user