Prepares 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.
Signed-off-by: Jorge Marques <jorge.marques@analog.com>
---
drivers/i3c/master.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 9e6be49bebb2c..c66f2655eb404 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -1016,6 +1016,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;
}
@@ -1796,8 +1800,6 @@ int i3c_master_do_daa_ext(struct i3c_master_controller *master, bool 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);
@@ -2093,7 +2095,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) {
--
2.51.1
On Thu, Mar 12, 2026 at 05:38:04PM +0100, Jorge Marques wrote:
> Prepares 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.
>
> Signed-off-by: Jorge Marques <jorge.marques@analog.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/i3c/master.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index 9e6be49bebb2c..c66f2655eb404 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -1016,6 +1016,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;
> }
>
> @@ -1796,8 +1800,6 @@ int i3c_master_do_daa_ext(struct i3c_master_controller *master, bool 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);
> @@ -2093,7 +2095,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) {
>
> --
> 2.51.1
>
On 12/03/2026 18:38, Jorge Marques wrote:
> Prepares to fix improper Mx positive error propagation in later
Prepares -> Prepare
> 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.
>
> Signed-off-by: Jorge Marques <jorge.marques@analog.com>
Minor cosmetic issue below.
Otherwise:
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> drivers/i3c/master.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index 9e6be49bebb2c..c66f2655eb404 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -1016,6 +1016,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;
> }
>
> @@ -1796,8 +1800,6 @@ int i3c_master_do_daa_ext(struct i3c_master_controller *master, bool rstdaa)
>
> if (rstdaa) {
> rstret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
> - if (rstret == I3C_ERROR_M2)
> - rstret = 0;
> }
{} no longer needed
>
> ret = master->ops->do_daa(master);
> @@ -2093,7 +2095,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) {
>
© 2016 - 2026 Red Hat, Inc.