Linux CXL
 help / color / mirror / Atom feed
From: "Cao, Quanquan/曹 全全" <caoqq@fujitsu.com>
To: Dan Williams <dan.j.williams@intel.com>,
	dave.jiang@intel.com, vishal.l.verma@intel.com
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH] cxl/mbox: Code readability improvement
Date: Tue, 30 Jan 2024 16:28:08 +0800	[thread overview]
Message-ID: <ce520bbc-702f-356b-2ee2-d392121b03fb@fujitsu.com> (raw)
In-Reply-To: <65b89e67ca4e9_59028294a@dwillia2-mobl3.amr.corp.intel.com.notmuch>


> 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.

Thanks, I got.

      reply	other threads:[~2024-01-30  8:28 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
2024-01-30  8:28   ` Cao, Quanquan/曹 全全 [this message]

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=ce520bbc-702f-356b-2ee2-d392121b03fb@fujitsu.com \
    --to=caoqq@fujitsu.com \
    --cc=dan.j.williams@intel.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