mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chen Ni <nichen@iscas.ac.cn>
To: Marcelo Schmitt <marcelo.schmitt@analog.com>,
	Jonathan Cameron <jic23@kernel.org>
Cc: "Nuno Sá" <nuno.sa@analog.com>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"David Lechner" <dlechner@baylibre.com>,
	linux@analog.com, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org, "Chen Ni" <nichen@iscas.ac.cn>,
	"Joshua Crofts" <crofts@kernel.org>,
	"Andy Shevchenko" <andriy.shevchenko@intel.com>
Subject: [PATCH v2] iio: adc: ad4134: Fix duplicate data_read mux state request
Date: Thu,  5 Nov 2026 11:31:20 +0800	[thread overview]
Message-ID: <20261105033120.387616-1-nichen@iscas.ac.cn> (raw)

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@iscas.ac.cn>
Reviewed-by: Joshua Crofts <crofts@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
---
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


             reply	other threads:[~2026-11-05  3:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05  3:31 Chen Ni [this message]
2026-11-05 13:18 ` Joshua Crofts
2026-11-07 20:04   ` Jonathan Cameron
2026-11-09  1:08 ` Marcelo Schmitt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261105033120.387616-1-nichen@iscas.ac.cn \
    --to=nichen@iscas.ac.cn \
    --cc=Michael.Hennerich@analog.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=crofts@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@analog.com \
    --cc=marcelo.schmitt@analog.com \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®