Commit 8e9bdb56 authored by Charles Han's avatar Charles Han Committed by Greg Kroah-Hartman
Browse files

power: supply: cpcap-charger: Fix null check for power_supply_get_by_name



[ Upstream commit d9fa3aae ]

In the cpcap_usb_detect() function, the power_supply_get_by_name()
function may return `NULL` instead of an error pointer.
To prevent potential null pointer dereferences, Added a null check.

Fixes: eab4e6d9 ("power: supply: cpcap-charger: get the battery inserted infomation from cpcap-battery")
Signed-off-by: default avatarCharles Han <hanchunchao@inspur.com>
Link: https://lore.kernel.org/r/20250519024741.5846-1-hanchunchao@inspur.com


Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 51990eec
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment