提交 c9398455 编写于 作者: D Dmitry Osipenko 提交者: Sebastian Reichel

power: supply: core: Fix parsing of battery chemistry/technology

The power_supply_get_battery_info() fails if device-chemistry property
is missing in a device-tree because error variable is propagated to the
final return of the function, fix it.

Fixes: 4eef766b ("power: supply: core: Parse battery chemistry/technology")
Signed-off-by: NDmitry Osipenko <digetx@gmail.com>
Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: NSebastian Reichel <sebastian.reichel@collabora.com>
上级 eaa2c490
......@@ -619,8 +619,7 @@ int power_supply_get_battery_info(struct power_supply *psy,
* Documentation/power/power_supply_class.rst.
*/
err = of_property_read_string(battery_np, "device-chemistry", &value);
if (!err) {
if (!of_property_read_string(battery_np, "device-chemistry", &value)) {
if (!strcmp("nickel-cadmium", value))
info->technology = POWER_SUPPLY_TECHNOLOGY_NiCd;
else if (!strcmp("nickel-metal-hydride", value))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册