Linux CXL
 help / color / mirror / Atom feed
* [PATCH] cxl/mbox: Code readability improvement
@ 2024-01-30  5:58 Quanquan Cao
  2024-01-30  6:59 ` Dan Williams
  0 siblings, 1 reply; 3+ messages in thread
From: Quanquan Cao @ 2024-01-30  5:58 UTC (permalink / raw)
  To: dave.jiang, vishal.l.verma; +Cc: linux-cxl, Quanquan Cao

"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)
+	if (send_cmd->id == CXL_MEM_COMMAND_ID_INVALID ||
+	    send_cmd->id >= CXL_MEM_COMMAND_ID_MAX)
 		return -ENOTTY;
 
 	/*
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-30  8:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox