Re: [PATCH 1/5] i3c: master: Move rstdaa error suppression

From: Adrian Hunter

Date: Tue Mar 10 2026 - 15:13:59 EST


On 08/03/2026 18:47, Jorge Marques wrote:
> The CCC RSTDAA is invoked with i3c_master_rstdaa_locked
> even if there are no devices active on the bus, resulting
> in error I3C_ERROR_M2. Handle inside i3c_master_rstdaa_locked,
> checking cmd->err directly.

The commit message could use some explanation why the change
is being made, what it achieves in terms of preparing for the
later fix.

It should mention that there are 4 call sites of i3c_master_rstdaa_locked().
2 ignore the return value, and so need not be changed.
And the 2 in this patch.

Also, since this is a prerequisite for a bug fix, I would
suggest a fixes tag.

>
> Signed-off-by: Jorge Marques <jorge.marques@xxxxxxxxxx>
> ---
> drivers/i3c/master.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index 9e6be49bebb2..31822fd5ffde 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;
> }
>
> @@ -1785,7 +1789,6 @@ i3c_master_register_new_i3c_devs(struct i3c_master_controller *master)
> */
> int i3c_master_do_daa_ext(struct i3c_master_controller *master, bool rstdaa)
> {
> - int rstret = 0;
> int ret;
>
> ret = i3c_master_rpm_get(master);
> @@ -1795,9 +1798,9 @@ int i3c_master_do_daa_ext(struct i3c_master_controller *master, bool rstdaa)
> i3c_bus_maintenance_lock(&master->bus);
>
> if (rstdaa) {
> - rstret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
> - if (rstret == I3C_ERROR_M2)
> - rstret = 0;
> + ret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
> + if (ret)
> + goto out;
> }
>
> ret = master->ops->do_daa(master);
> @@ -1813,7 +1816,7 @@ int i3c_master_do_daa_ext(struct i3c_master_controller *master, bool rstdaa)
> out:
> i3c_master_rpm_put(master);
>
> - return rstret ?: ret;
> + return ret;
> }
> EXPORT_SYMBOL_GPL(i3c_master_do_daa_ext);
>
> @@ -2093,7 +2096,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) {
>