* [PATCH] iio: adc: ad4134: Fix duplicate data_read mux state request
@ 2026-11-04 4:47 Chen Ni
2026-11-04 8:09 ` Joshua Crofts
2026-11-04 11:02 ` Andy Shevchenko
0 siblings, 2 replies; 3+ messages in thread
From: Chen Ni @ 2026-11-04 4:47 UTC (permalink / raw)
To: Marcelo Schmitt, Jonathan Cameron
Cc: Nuno Sá,
Michael Hennerich, David Lechner, Andy Shevchenko, linux,
linux-iio, linux-kernel, Chen Ni
devm_mux_state_get(dev, "data_read") 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@iscas.ac.cn>
---
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: adc: ad4134: Fix duplicate data_read mux state request
2026-11-04 4:47 [PATCH] iio: adc: ad4134: Fix duplicate data_read mux state request Chen Ni
@ 2026-11-04 8:09 ` Joshua Crofts
2026-11-04 11:02 ` Andy Shevchenko
1 sibling, 0 replies; 3+ messages in thread
From: Joshua Crofts @ 2026-11-04 8:09 UTC (permalink / raw)
To: Chen Ni
Cc: Marcelo Schmitt, Jonathan Cameron, Nuno Sá,
Michael Hennerich, David Lechner, Andy Shevchenko, linux,
linux-iio, linux-kernel
On Wed, 4 Nov 2026 12:47:19 +0800
Chen Ni <nichen@iscas.ac.cn> wrote:
> devm_mux_state_get(dev, "data_read") 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@iscas.ac.cn>
> ---
Reviewed-by: Joshua Crofts <crofts@kernel.org>
--
Kind regards,
Joshua Crofts
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: adc: ad4134: Fix duplicate data_read mux state request
2026-11-04 4:47 [PATCH] iio: adc: ad4134: Fix duplicate data_read mux state request Chen Ni
2026-11-04 8:09 ` Joshua Crofts
@ 2026-11-04 11:02 ` Andy Shevchenko
1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2026-11-04 11:02 UTC (permalink / raw)
To: Chen Ni
Cc: Marcelo Schmitt, Jonathan Cameron, Nuno Sá,
Michael Hennerich, David Lechner, Andy Shevchenko, linux,
linux-iio, linux-kernel
On Wed, Nov 04, 2026 at 12:47:19PM +0800, Chen Ni wrote:
> devm_mux_state_get(dev, "data_read") 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.
Make the line lengths more balanced. Refer to the functions
as simply as func().
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.
Otherwise it looks like a rebase error which went unnoticed as
the mux state is stored after the check.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-04 11:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04 4:47 [PATCH] iio: adc: ad4134: Fix duplicate data_read mux state request Chen Ni
2026-11-04 8:09 ` Joshua Crofts
2026-11-04 11:02 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®