[PATCH 5/5] i3c: master: adi: Return xfer->ret at send CCC

Jorge Marques posted 5 patches 1 month ago
There is a newer version of this series
[PATCH 5/5] i3c: master: adi: Return xfer->ret at send CCC
Posted by Jorge Marques 1 month ago
Return the xfer-> ret error code at adi_i3c_master_send_ccc_cmd to
propagate the adi_i3c_master_end_xfer_locked value. In particular, if
any of the Mx values are present in the sent commands, returns -EIO.

Signed-off-by: Jorge Marques <jorge.marques@analog.com>
---
 drivers/i3c/master/adi-i3c-master.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i3c/master/adi-i3c-master.c b/drivers/i3c/master/adi-i3c-master.c
index fb9a48830446..047081c9f064 100644
--- a/drivers/i3c/master/adi-i3c-master.c
+++ b/drivers/i3c/master/adi-i3c-master.c
@@ -361,7 +361,7 @@ static int adi_i3c_master_send_ccc_cmd(struct i3c_master_controller *m,
 
 	cmd->err = adi_i3c_cmd_get_err(&xfer->cmds[0]);
 
-	return 0;
+	return xfer->ret;
 }
 
 static int adi_i3c_master_i3c_xfers(struct i3c_dev_desc *dev,

-- 
2.51.1
Re: [PATCH 5/5] i3c: master: adi: Return xfer->ret at send CCC
Posted by Adrian Hunter 4 weeks, 1 day ago
On 08/03/2026 18:47, Jorge Marques wrote:
> Return the xfer-> ret error code at adi_i3c_master_send_ccc_cmd to
> propagate the adi_i3c_master_end_xfer_locked value. In particular, if
> any of the Mx values are present in the sent commands, returns -EIO.

Isn't this also a bug fix.   I suggest a fixes tag and
better commit message e.g.

  i3c: master: adi: Fix missing error propagation for CCC commands

  adi_i3c_master_send_ccc_cmd() always returned 0, ignoring the transfer
  result populated in the completion path. As a consequence, CCC command
  errors - such as those reported by adi_i3c_master_end_xfer_locked() - were
  silently dropped.

  Fix this by returning xfer->ret so that callers correctly receive any
  transfer error codes.

By the way, I don't see an error code being set in the timeout case?

> 
> Signed-off-by: Jorge Marques <jorge.marques@analog.com>
> ---
>  drivers/i3c/master/adi-i3c-master.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i3c/master/adi-i3c-master.c b/drivers/i3c/master/adi-i3c-master.c
> index fb9a48830446..047081c9f064 100644
> --- a/drivers/i3c/master/adi-i3c-master.c
> +++ b/drivers/i3c/master/adi-i3c-master.c
> @@ -361,7 +361,7 @@ static int adi_i3c_master_send_ccc_cmd(struct i3c_master_controller *m,
>  
>  	cmd->err = adi_i3c_cmd_get_err(&xfer->cmds[0]);
>  
> -	return 0;
> +	return xfer->ret;
>  }
>  
>  static int adi_i3c_master_i3c_xfers(struct i3c_dev_desc *dev,
>
Re: [PATCH 5/5] i3c: master: adi: Return xfer->ret at send CCC
Posted by Jorge Marques 3 weeks, 6 days ago
On Tue, Mar 10, 2026 at 09:15:25PM +0200, Adrian Hunter wrote:
> On 08/03/2026 18:47, Jorge Marques wrote:
> > Return the xfer-> ret error code at adi_i3c_master_send_ccc_cmd to
> > propagate the adi_i3c_master_end_xfer_locked value. In particular, if
> > any of the Mx values are present in the sent commands, returns -EIO.
> 
> Isn't this also a bug fix.   I suggest a fixes tag and
> better commit message e.g.
> 
>   i3c: master: adi: Fix missing error propagation for CCC commands
> 
>   adi_i3c_master_send_ccc_cmd() always returned 0, ignoring the transfer
>   result populated in the completion path. As a consequence, CCC command
>   errors - such as those reported by adi_i3c_master_end_xfer_locked() - were
>   silently dropped.
> 
>   Fix this by returning xfer->ret so that callers correctly receive any
>   transfer error codes.
> 
> By the way, I don't see an error code being set in the timeout case?
> 
Hi Adrian, when the xfer is allocated, the default xfer->ret value is
set to -ETIMEDOUT, so un-queuing retains this value and is (with this
patch) returned.

Regards,
Jorge