[PATCH v2] iio: adc: ad4134: Fix duplicate data_read mux state request

From: Chen Ni

Date: Wed Nov 04 2026 - 22:35:14 EST


devm_mux_state_get() is called twice in a row. The second call's result
is stored directly into st->mux_st[AD4134_DOUT0_INPUT] without error
checking, and then immediately overwritten by the first call's result.

Remove the duplicate call and check the return value before saving the
state.

Fixes: f12ecb3e147b ("iio: adc: ad4134: Support SPI 4-wire mode")
Signed-off-by: Chen Ni <nichen@xxxxxxxxxxx>
Reviewed-by: Joshua Crofts <crofts@xxxxxxxxxx>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
---
Changes in v2:
- Update commit message as suggested by Andy Shevchenko.
- Add Reviewed-by tags from Andy Shevchenko and Joshua Crofts.
---
drivers/iio/adc/ad4134.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/iio/adc/ad4134.c b/drivers/iio/adc/ad4134.c
index bc6407ae25e0..35fe387b9ac8 100644
--- a/drivers/iio/adc/ad4134.c
+++ b/drivers/iio/adc/ad4134.c
@@ -1112,7 +1112,6 @@ static int ad4134_probe(struct spi_device *spi)
st->mux_st[AD4134_SDO_INPUT] = mux_st;

mux_st = devm_mux_state_get(dev, "data_read");
- st->mux_st[AD4134_DOUT0_INPUT] = devm_mux_state_get(dev, "data_read");
if (IS_ERR(mux_st))
return dev_err_probe(dev, PTR_ERR(mux_st),
"failed to get data_read mux-state\n");
--
2.25.1