Skip to contentSkip to conversation

iio: adc: ad4134: Fix duplicate data_read mux state request

PATCH In review Chen Ni 4 participants 5 messages Nov 5 – Nov 14

Subsystems (3)
lore
Share & tools
lore

Chen Ni

author
#0 lore raw

PATCH v2 1/1 iio: adc: ad4134: Fix duplicate data_read mux state request

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")

---
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(-)
drivers/iio/adc/ad4134.c +0 -1
index bc6407ae25e0..35fe387b9ac8 100644
@@ -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");
Signature · 1 line
2.25.1
#1 lore raw
Quoted 9 lines · On Thu, 5 Nov 2026 11:31:20 +0800 Chen Ni <[email protected]> wrote:

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")

Ideally your Signed-off-by tag should be the last one in the tag block. No need to resend however, this can be tweaked when applying.

Signature · 2 lines
Kind regards,
Joshua Crofts
maintainer
#2 lore raw
Quoted 7 lines · On Thu, 5 Nov 2026 14:18:46 +0100 Joshua Crofts <[email protected]> wrote:
Quoted 4 lines · On Thu, 5 Nov 2026 11:31:20 +0800 Chen Ni <[email protected]> wrote:

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.

Quoted 9 lines
Quoted 5 lines

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

Fixes f12ecb3e147b ("iio: adc: ad4134: Support SPI 4-wire mode")

Ideally your Signed-off-by tag should be the last one in the tag block. No need to resend however, this can be tweaked when applying.

Applied but with fixes tag dropped. Those aren't stable until a series has gone upstream and I've long given up on trying to fix them up as the tree evolves.

I tweaked the ordering though I'll note I normally don't bother too much on this as any review tags that come in after the new posting go after the sign off anyway so it's a subtle distinction that I'm not sure matters in practice!

Marcelo, this one looks obviously right but please take a look just to be sure.

Jonathan

Reviewed-by on v2 1/1
#3 lore raw
In reply to Chen Ni
Quoted 4 lines · Chen Ni

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.

Quoted 8 lines

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

Fixes f12ecb3e147b ("iio: adc: ad4134: Support SPI 4-wire mode")

---

LGTM
If still worth anything,

Thanks,
Marcelo

maintainer
#4 lore raw
Quoted 8 lines · On Sun, 8 Nov 2026 22:08:37 -0300 Marcelo Schmitt <[email protected]>…
Quoted 7 lines · Chen Ni

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.

Quoted 8 lines
Quoted 5 lines
Fixes f12ecb3e147b ("iio: adc: ad4134: Support SPI 4-wire mode")

---

LGTM
If still worth anything,

Even if it is too later to add to the git log, it is still useful to have this here for future reference! On this occasion I have just updated the commit to add the tag.

Thanks,

Jonathan

Quoted 3 lines

Thanks,
Marcelo