[PATCH] hwmon: (ads7828) Properly handle -EPROBE_DEFER from devm_regulator_get_optional()
Qingshuang Fu <[email protected]> Wed, 5 Aug 2026 10:05:06 +0800
| Newsgroups | org.kernel.vger.linux-hwmon,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
From: Qingshuang Fu <[email protected]> When devm_regulator_get_optional() returns -EPROBE_DEFER, the driver currently ignores the error and incorrectly falls back to internal VREF, even if an external vref is defined in device tree. This could lead to conflicting voltage sources on the VREF pin and inaccurate ADC readings. Check for -EPROBE_DEFER explicitly and return it to trigger probe deferral. Treat other errors (such as -ENODEV) as "no external vref" and use internal reference. Fixes: a8ddfea09566 ("hwmon: (ads7828) Accept optional parameters from device tree") Signed-off-by: Qingshuang Fu <[email protected]> --- drivers/hwmon/ads7828.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hwmon/ads7828.c b/drivers/hwmon/ads7828.c index 149cfcec78dc..1c4a04cb023c 100644 --- a/drivers/hwmon/ads7828.c +++ b/drivers/hwmon/ads7828.c @@ -133,6 +133,8 @@ static int ads7828_probe(struct i2c_client *client) vref_mv > ADS7828_EXT_VREF_MV_MAX) return -EINVAL; ext_vref = true; + } else if (PTR_ERR(reg) == -EPROBE_DEFER) { + return PTR_ERR(reg); } } base-commit: c21bb4193868a8de71fc4693fa741e195fdf5d86 -- 2.25.1