]> git.baikalelectronics.ru Git - kernel.git/commit
power: supply: Fix power_supply_am_i_supplied to return -ENODEV when apropriate
authorHans de Goede <hdegoede@redhat.com>
Sun, 6 Aug 2017 16:23:52 +0000 (18:23 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.co.uk>
Wed, 9 Aug 2017 15:56:46 +0000 (17:56 +0200)
commited3c5fa77cb6d107985a5d96f534591b8b43abde
tree47b5d7293d8c857ac56a8131c1d7d53a3c6f73fe
parent29e5c81f3ea26aa1a50964f8ee967c05e6329573
power: supply: Fix power_supply_am_i_supplied to return -ENODEV when apropriate

Commit 6d5eb29a9a7a ("power: supply: Make power_supply_am_i_supplied return
-ENODEV if there are no suppliers") was supposed to make
power_supply_am_i_supplied() return -ENODEV when there are no supplies
which supply the supply passed to it.

But instead it will only return -ENODEV when there are no supplies at
all as data->count++; is incremented on every call of the iterator, rather
then only when __power_supply_is_supplied_by returns true. This commit
fixes this.

Fixes: 6d5eb29a9a7a ("power: supply: Make power_supply_am_i_supplied ...")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
drivers/power/supply/power_supply_core.c