Re: [PATCH v3 5/8] iio: temperature: ltc2983: Fix n_wires default bypassing rotation check

From: Jonathan Cameron

Date: Fri May 22 2026 - 09:21:34 EST


On Thu, 21 May 2026 19:42:58 +0300
Liviu Stan <liviu.stan@xxxxxxxxxx> wrote:

> When adi,number-of-wires is absent, n_wires is left at 0. The binding
> documents a default of 2 wires, matching the hardware default. However
> the current-rotate validation checks n_wires == 2 || n_wires == 3, so
> with n_wires = 0 the guard is bypassed and adi,current-rotate is accepted
> for a 2-wire RTD.
>
> Initialize n_wires = 2 to match the binding default and ensure the
> rotation check fires correctly when the property is absent.
>
> Fixes: f110f3188e56 ("iio: temperature: Add support for LTC2983")
> Signed-off-by: Liviu Stan <liviu.stan@xxxxxxxxxx>
This should be the first patch in the series so it is obvious that it
is easily backported without the rest + I might pick up via the fixes-togreg
tree.

Jonathan

> ---
> Changes in v3:
> - New patch
>
> drivers/iio/temperature/ltc2983.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/temperature/ltc2983.c b/drivers/iio/temperature/ltc2983.c
> index 10f423fbe9cc..326f843f4271 100644
> --- a/drivers/iio/temperature/ltc2983.c
> +++ b/drivers/iio/temperature/ltc2983.c
> @@ -749,7 +749,7 @@ ltc2983_rtd_new(const struct fwnode_handle *child, struct ltc2983_data *st,
> struct ltc2983_rtd *rtd;
> int ret = 0;
> struct device *dev = &st->spi->dev;
> - u32 excitation_current = 0, n_wires = 0;
> + u32 excitation_current = 0, n_wires = 2;
>
> rtd = devm_kzalloc(dev, sizeof(*rtd), GFP_KERNEL);
> if (!rtd)