]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
i3c: master: Move rstdaa error suppression
authorJorge Marques <jorge.marques@analog.com>
Mon, 23 Mar 2026 16:11:29 +0000 (17:11 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Sun, 12 Apr 2026 14:54:37 +0000 (16:54 +0200)
Prepare to fix improper Mx positive error propagation in later
commits by handling Mx error codes where the i3c_ccc_cmd command
is allocated. Two of the four i3c_master_rstdaa_locked() are error
paths that already suppressed the return value, the remaining two
are changed to handle the I3C_ERROR_M2 Mx error code inside
i3c_master_rstdaa_locked(), checking cmd->err directly.

Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Jorge Marques <jorge.marques@analog.com>
Link: https://patch.msgid.link/20260323-ad4062-positive-error-fix-v3-1-30bdc68004be@analog.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/i3c/master.c

index 6dd3c0fd7823137f8eda7fc926e5cb589e7d406d..fc2e91ea8e1cfda42919c4ac8d12798e68e21033 100644 (file)
@@ -1043,6 +1043,10 @@ static int i3c_master_rstdaa_locked(struct i3c_master_controller *master,
        ret = i3c_master_send_ccc_cmd_locked(master, &cmd);
        i3c_ccc_cmd_dest_cleanup(&dest);
 
+       /* No active devices on the bus. */
+       if (ret && cmd.err == I3C_ERROR_M2)
+               ret = 0;
+
        return ret;
 }
 
@@ -1821,11 +1825,8 @@ int i3c_master_do_daa_ext(struct i3c_master_controller *master, bool rstdaa)
 
        i3c_bus_maintenance_lock(&master->bus);
 
-       if (rstdaa) {
+       if (rstdaa)
                rstret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
-               if (rstret == I3C_ERROR_M2)
-                       rstret = 0;
-       }
 
        ret = master->ops->do_daa(master);
 
@@ -2120,7 +2121,7 @@ static int i3c_master_bus_init(struct i3c_master_controller *master)
         * (assigned by the bootloader for example).
         */
        ret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
-       if (ret && ret != I3C_ERROR_M2)
+       if (ret)
                goto err_bus_cleanup;
 
        if (master->ops->set_speed) {