Re: [PATCH v4] hwmon: (ads7828) Fix external VREF regulator handling

[email protected] Wed, 05 Aug 2026 06:23:28 +0000
Newsgroups org.kernel.vger.linux-hwmon
Message-ID <[email protected]>
> From: Qingshuang Fu <[email protected]>
>=20
> The driver currently has two issues with the external VREF regulator
> handling in ads7828_probe():
>=20
> 1. All errors from devm_regulator_get_optional() are ignored, causing the
>    driver to incorrectly fall back to internal VREF even for transient
>    errors like -EPROBE_DEFER or genuine failures like -ENOMEM.
>=20
> 2. The external regulator is never enabled. The driver calls
>    regulator_get_voltage() without first calling regulator_enable(),
>    so the VREF pin may remain unpowered if the regulator is not
>    configured as always-on.
>=20
> Fix both issues by switching to devm_regulator_get_enable_read_voltage(),
> which handles regulator get, enable, and voltage read in one call.
> Only -ENODEV (no regulator specified in device tree) should trigger the
> fallback to internal VREF. All other errors are propagated to the caller.
>=20
> Fixes: a8ddfea09566 ("hwmon: (ads7828) Accept optional parameters from de=
vice tree")
> Signed-off-by: Qingshuang Fu <[email protected]>

Sashiko has reviewed this patch and found no issues. It looks great!

--=20
Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260805061645.1331=
[email protected]?part=3D1