[PATCH 3/5] i3c: master: Move bus_init error suppression
From: Jorge Marques
Date: Sun Mar 08 2026 - 12:51:36 EST
The CCC DISEC to broadcast address is invoked with
i3c_master_enec_disec_locked and yields error I3C_ERROR_M2 if there are
no devices active on the bus. This is expected at the bus initialization
stage, where it is not known yet that there are no active devices on the
bus.
Handle inside i3c_master_enec_disec_locked the exact corner case to not
require propagating positive Mx error codes.
Signed-off-by: Jorge Marques <jorge.marques@xxxxxxxxxx>
---
drivers/i3c/master.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index ce1898345810..3e465587c9c7 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -1078,6 +1078,15 @@ static int i3c_master_enec_disec_locked(struct i3c_master_controller *master,
ret = i3c_master_send_ccc_cmd_locked(master, &cmd);
i3c_ccc_cmd_dest_cleanup(&dest);
+ /*
+ * If the addr is I3C_BROADCAST_ADDR and enable is false, the return
+ * error is cleared if the Mx error is I3C_ERROR_M2, to match the
+ * initialization state where there is no active device on the bus.
+ */
+ if (ret && addr == I3C_BROADCAST_ADDR && !enable &&
+ cmd.err == I3C_ERROR_M2)
+ ret = 0;
+
return ret;
}
@@ -2112,7 +2121,7 @@ static int i3c_master_bus_init(struct i3c_master_controller *master)
ret = i3c_master_disec_locked(master, I3C_BROADCAST_ADDR,
I3C_CCC_EVENT_SIR | I3C_CCC_EVENT_MR |
I3C_CCC_EVENT_HJ);
- if (ret && ret != I3C_ERROR_M2)
+ if (ret)
goto err_bus_cleanup;
/*
--
2.51.1