]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
hwmon: sy7636a: Fix regulator_enable resource leak on error path
authorHaotian Zhang <vulab@iscas.ac.cn>
Wed, 26 Nov 2025 16:26:02 +0000 (00:26 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 12:55:09 +0000 (13:55 +0100)
commit0927f7b4dcb9dc046319e8026743c55d36ce6aaf
treea8d8ee41ac07181796518c13dd13f38bf50e8432
parent332825d72dcb3fcd57c9b7b06d902eda02932998
hwmon: sy7636a: Fix regulator_enable resource leak on error path

[ Upstream commit 2f88425ef590b7fcc2324334b342e048edc144a9 ]

In sy7636a_sensor_probe(), regulator_enable() is called but if
devm_hwmon_device_register_with_info() fails, the function returns
without calling regulator_disable(), leaving the regulator enabled
and leaking the reference count.

Switch to devm_regulator_get_enable() to automatically
manage the regulator resource.

Fixes: de34a4053250 ("hwmon: sy7636a: Add temperature driver for sy7636a")
Suggested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Link: https://lore.kernel.org/r/20251126162602.2086-1-vulab@iscas.ac.cn
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hwmon/sy7636a-hwmon.c