mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] i2c: mlxbf: return error code from mlxbf_i2c_reg_slave()
@ 2026-12-02 11:03 Ziheng Wei
  2026-12-04 23:09 ` David Thompson
  0 siblings, 1 reply; 2+ messages in thread
From: Ziheng Wei @ 2026-12-02 11:03 UTC (permalink / raw)
  To: Khalil Blaiech, Asmaa Mnebhi, Andi Shyti; +Cc: linux-i2c, linux-kernel, stable

In mlxbf_i2c_reg_slave(), if mlxbf_i2c_slave_enable() fails (for example,
returning -EBUSY when all hardware slave address slots are in use), the
driver logs an error message but still returns 0. As a result,
i2c_slave_register() believes registration succeeded and leaves
client->slave_cb installed for a slave that was never enabled in hardware.

Return ret from mlxbf_i2c_reg_slave(), matching mlxbf_i2c_unreg_slave().

Found by LLM-assisted static analysis. Compile-tested on x86_64.

Fixes: bdc4af281b70 ("i2c: mlxbf: add multi slave functionality")
Cc: stable@vger.kernel.org
Signed-off-by: Ziheng Wei <zihengw03@163.com>
---
 drivers/i2c/busses/i2c-mlxbf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c
index 432d9588f..8357c5431 100644
--- a/drivers/i2c/busses/i2c-mlxbf.c
+++ b/drivers/i2c/busses/i2c-mlxbf.c
@@ -2126,7 +2126,7 @@ static int mlxbf_i2c_reg_slave(struct i2c_client *slave)
 	if (ret)
 		dev_err(dev, "Surpassed max number of registered slaves allowed\n");
 
-	return 0;
+	return ret;
 }
 
 static int mlxbf_i2c_unreg_slave(struct i2c_client *slave)

base-commit: 97d73c8251226cf27cc6656b4c542869bb8c69fa
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] i2c: mlxbf: return error code from mlxbf_i2c_reg_slave()
  2026-12-02 11:03 [PATCH] i2c: mlxbf: return error code from mlxbf_i2c_reg_slave() Ziheng Wei
@ 2026-12-04 23:09 ` David Thompson
  0 siblings, 0 replies; 2+ messages in thread
From: David Thompson @ 2026-12-04 23:09 UTC (permalink / raw)
  To: zihengw03
  Cc: andi.shyti, asmaa, kblaiech, linux-i2c, linux-kernel, stable,
	cbabroski, David Thompson

Thanks for the patch. Looks good to me.

Reviewed-by: David Thompson <davthompson@nvidia.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-04 23:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-02 11:03 [PATCH] i2c: mlxbf: return error code from mlxbf_i2c_reg_slave() Ziheng Wei
2026-12-04 23:09 ` David Thompson

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®