power: supply: ab8500: Avoid NULL pointers
authorLinus Walleij <linus.walleij@linaro.org>
Sat, 22 May 2021 22:50:41 +0000 (00:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:17:51 +0000 (16:17 +0200)
commit230208c91224e5ef214d27d722e2c4fc7aaba79b
tree3a6f246aa5d5435d9208eb2b48d1be45b7721437
parentdf87af9a83dd21266803f3f7c521bcee2331e8ed
power: supply: ab8500: Avoid NULL pointers

[ Upstream commit 5bcb5087c9dd3dca1ff0ebd8002c5313c9332b56 ]

Sometimes the code will crash because we haven't enabled
AC or USB charging and thus not created the corresponding
psy device. Fix it by checking that it is there before
notifying.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/power/supply/ab8500_charger.c