]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
power: supply: max14577: Handle NULL pdata when CONFIG_OF is not set
authorCharles Han <hanchunchao@inspur.com>
Mon, 19 May 2025 06:16:01 +0000 (14:16 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Aug 2025 10:05:01 +0000 (12:05 +0200)
commitbe2c39883b85cbdac3dc7de09ce860b82d05f994
treeeb0da0d65d5102ff785c48d2bfd9be5c3a3bd95f
parenta2436263144980cc99a9860c7b43335847afbe53
power: supply: max14577: Handle NULL pdata when CONFIG_OF is not set

[ Upstream commit 2937f5d2e24eefef8cb126244caec7fe3307f724 ]

When the kernel is not configured  CONFIG_OF, the max14577_charger_dt_init
function returns NULL. Fix the max14577_charger_probe functionby returning
-ENODATA instead of potentially passing a NULL pointer to PTR_ERR.

This fixes the below smatch warning:
max14577_charger_probe() warn: passing zero to 'PTR_ERR'

Fixes: e30110e9c96f ("charger: max14577: Configure battery-dependent settings from DTS and sysfs")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20250519061601.8755-1-hanchunchao@inspur.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/power/supply/max14577_charger.c