All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] power: supply: core: Fix parsing of battery chemistry/technology
@ 2021-08-19 23:51 Dmitry Osipenko
  2021-08-20 13:41 ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Osipenko @ 2021-08-19 23:51 UTC (permalink / raw)
  To: Sebastian Reichel, Linus Walleij; +Cc: linux-pm, linux-kernel

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: 4eef766b7d4d ("power: supply: core: Parse battery chemistry/technology")
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/power/supply/power_supply_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index dd62c871b2b5..0c2132c7f5d4 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -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))
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] power: supply: core: Fix parsing of battery chemistry/technology
  2021-08-19 23:51 [PATCH v1] power: supply: core: Fix parsing of battery chemistry/technology Dmitry Osipenko
@ 2021-08-20 13:41 ` Linus Walleij
  2021-08-20 16:59   ` Sebastian Reichel
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2021-08-20 13:41 UTC (permalink / raw)
  To: Dmitry Osipenko; +Cc: Sebastian Reichel, Linux PM list, linux-kernel

On Fri, Aug 20, 2021 at 1:51 AM Dmitry Osipenko <digetx@gmail.com> wrote:

> 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: 4eef766b7d4d ("power: supply: core: Parse battery chemistry/technology")
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>

Oops,
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] power: supply: core: Fix parsing of battery chemistry/technology
  2021-08-20 13:41 ` Linus Walleij
@ 2021-08-20 16:59   ` Sebastian Reichel
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2021-08-20 16:59 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Dmitry Osipenko, Linux PM list, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 598 bytes --]

Hi,

On Fri, Aug 20, 2021 at 03:41:56PM +0200, Linus Walleij wrote:
> On Fri, Aug 20, 2021 at 1:51 AM Dmitry Osipenko <digetx@gmail.com> wrote:
> 
> > 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: 4eef766b7d4d ("power: supply: core: Parse battery chemistry/technology")
> > Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> 
> Oops,
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Thanks, queued.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-20 16:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 23:51 [PATCH v1] power: supply: core: Fix parsing of battery chemistry/technology Dmitry Osipenko
2021-08-20 13:41 ` Linus Walleij
2021-08-20 16:59   ` Sebastian Reichel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.