[PATCH] nvmet: fix the warning of assigne int to __le16

Guixin Liu kanie at linux.alibaba.com
Fri Nov 8 00:30:30 PST 2024


Even though NVME_CNTLID_DYNAMIC is 0xffff, we still need use
cpu_to_le16 to translate it to litte-endian.

Signed-off-by: Guixin Liu <kanie at linux.alibaba.com>
---
 drivers/nvme/target/pr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/target/pr.c b/drivers/nvme/target/pr.c
index 60899c22e7b6..bef82135a0e7 100644
--- a/drivers/nvme/target/pr.c
+++ b/drivers/nvme/target/pr.c
@@ -854,7 +854,7 @@ static void nvmet_execute_pr_report(struct nvmet_req *req)
 		/*
 		 * Dynamic controller, set cntlid to 0xffff.
 		 */
-		ctrl_eds->cntlid = NVME_CNTLID_DYNAMIC;
+		ctrl_eds->cntlid = cpu_to_le16(NVME_CNTLID_DYNAMIC);
 		if (rtype == NVME_PR_WRITE_EXCLUSIVE_ALL_REGS ||
 		    rtype == NVME_PR_EXCLUSIVE_ACCESS_ALL_REGS)
 			ctrl_eds->rcsts = 1;
-- 
2.43.0




More information about the Linux-nvme mailing list