Re: [PATCH v3 2/2] cxl/mbox: Use mapped errno to determine command status

From: Dave Jiang

Date: Tue Nov 17 2026 - 11:31:43 EST




On 11/16/26 12:09 AM, Li Ming wrote:
> cxl_mbox_cmd_rctable already maps all mailbox command return codes to
> errno values. Use the returned errno directly instead of checking
> mailbox return codes separately to determine whether a command succeeded
> or failed.
>
> Signed-off-by: Li Ming <ming.li@xxxxxxxxxxxx>
> Reviewed-by: Davidlohr Bueso <dave@xxxxxxxxxxxx>

Applied to cxl/next:
ecd99b9602b2

> ---
> v3:
> - No change.
> v2:
> - New patch.
> ---
> drivers/cxl/core/mbox.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> index 55828a836c01..bd91b03c4d21 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -270,9 +270,9 @@ int cxl_internal_send_cmd(struct cxl_mailbox *cxl_mbox,
> if (rc)
> return rc;
>
> - if (mbox_cmd->return_code != CXL_MBOX_CMD_RC_SUCCESS &&
> - mbox_cmd->return_code != CXL_MBOX_CMD_RC_BACKGROUND)
> - return cxl_mbox_cmd_rc2errno(mbox_cmd);
> + rc = cxl_mbox_cmd_rc2errno(mbox_cmd);
> + if (rc)
> + return rc;
>
> if (!out_size)
> return 0;