Linux CXL
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Quanquan Cao <caoqq@fujitsu.com>, <dave.jiang@intel.com>,
	<vishal.l.verma@intel.com>
Cc: <linux-cxl@vger.kernel.org>, Quanquan Cao <caoqq@fujitsu.com>
Subject: Re: [PATCH] cxl/mbox: Code readability improvement
Date: Mon, 29 Jan 2024 22:59:51 -0800	[thread overview]
Message-ID: <65b89e67ca4e9_59028294a@dwillia2-mobl3.amr.corp.intel.com.notmuch> (raw)
In-Reply-To: <20240130055844.19811-1-caoqq@fujitsu.com>

Quanquan Cao wrote:
> "send_cmd->id == 0" indicates an invalid command, so replace 0
> to CXL_MEM_COMMAND_ID_INVALID to make it easy for reading/understanding.
> 
> Signed-off-by: Quanquan Cao <caoqq@fujitsu.com>
> ---
>  drivers/cxl/core/mbox.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> index 27166a411705..2e5ee05011d6 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -485,7 +485,8 @@ static int cxl_validate_cmd_from_user(struct cxl_mbox_cmd *mbox_cmd,
>  	struct cxl_mem_command mem_cmd;
>  	int rc;
>  
> -	if (send_cmd->id == 0 || send_cmd->id >= CXL_MEM_COMMAND_ID_MAX)

"non-zero" is readable to me, and less characters to parse means current
code is literally easier to read.

  reply	other threads:[~2024-01-30  6:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-30  5:58 [PATCH] cxl/mbox: Code readability improvement Quanquan Cao
2024-01-30  6:59 ` Dan Williams [this message]
2024-01-30  8:28   ` Cao, Quanquan/曹 全全

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=65b89e67ca4e9_59028294a@dwillia2-mobl3.amr.corp.intel.com.notmuch \
    --to=dan.j.williams@intel.com \
    --cc=caoqq@fujitsu.com \
    --cc=dave.jiang@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox