[PATCH] hwmon: sy7636a: Fix regulator_enable resource leak on error path

From: Haotian Zhang

Date: Wed Nov 26 2025 - 05:55:16 EST


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.

Add regulator_disable() call in the error path to properly disable
the regulator.

Fixes: de34a4053250 ("hwmon: sy7636a: Add temperature driver for sy7636a")
Signed-off-by: Haotian Zhang <vulab@xxxxxxxxxxx>
---
drivers/hwmon/sy7636a-hwmon.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/hwmon/sy7636a-hwmon.c b/drivers/hwmon/sy7636a-hwmon.c
index ed110884786b..b8e598a616ad 100644
--- a/drivers/hwmon/sy7636a-hwmon.c
+++ b/drivers/hwmon/sy7636a-hwmon.c
@@ -88,6 +88,7 @@ static int sy7636a_sensor_probe(struct platform_device *pdev)
if (IS_ERR(hwmon_dev)) {
err = PTR_ERR(hwmon_dev);
dev_err(&pdev->dev, "Unable to register hwmon device, returned %d\n", err);
+ regulator_disable(regulator);
return err;
}

--
2.50.1.windows.1