[PATCH 3/3] i2c: mux: pca954x: Report deselect failures

From: Bart Van Assche

Date: Fri Nov 06 2026 - 15:34:33 EST


The i2c-mux core ignores the return value of the deselect callback.
Hence, if programming the mux into its idle state fails, the failure
goes unnoticed and a channel may remain connected until the next
transfer reprograms the mux. Log a rate-limited warning if
pca954x_deselect_mux() fails.

Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
drivers/i2c/muxes/i2c-mux-pca954x.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index 91df2d2fa2b7..45a7d841e7cf 100644
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
@@ -359,7 +359,21 @@ static int pca954x_set_idle_state(struct i2c_mux_core *muxc)

static int pca954x_deselect_mux(struct i2c_mux_core *muxc, u32 chan)
{
- return pca954x_set_idle_state(muxc);
+ struct pca954x *data = i2c_mux_priv(muxc);
+ int ret;
+
+ ret = pca954x_set_idle_state(muxc);
+ /*
+ * The i2c-mux core ignores the deselect return value. Report failures
+ * since these may leave a channel connected until the next transfer
+ * reprograms the mux.
+ */
+ if (ret < 0)
+ dev_warn_ratelimited(&data->client->dev,
+ "failed to deselect channel %u: %d\n",
+ chan, ret);
+
+ return ret;
}

static ssize_t idle_state_show(struct device *dev,