iio: adc: ad4134: Fix duplicate data_read mux state request
Subsystems (3)
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.
---
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
@@ -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
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")Signed-off-by Chen Ni <[email protected]>
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
Jonathan Cameron
maintainerQuoted 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")Signed-off-by Chen Ni <[email protected]>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
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")Signed-off-by Chen Ni <[email protected]>Reviewed-by Joshua Crofts <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>---
LGTM
If still worth anything,
Thanks,
Marcelo
Jonathan Cameron
maintainerQuoted 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")Signed-off-by Chen Ni <[email protected]>Reviewed-by Joshua Crofts <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>---
LGTM
If still worth anything,Reviewed-by Marcelo Schmitt <[email protected]>
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