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:05:46 +0000 (16:05 +0200)
commit14016c17282025f474f72c25837fa6587ee6c5e7
tree497c66a348ae1f0d5e226b06da5e94880d52c242
parent0df49cdc7c154e9e852cd6ec68416003d16f994b
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