From 05db1563c53de43ba32ab00c013aba2137a28fed Mon Sep 17 00:00:00 2001 From: Ryan McClelland Date: Tue, 8 Apr 2025 11:08:49 -0700 Subject: [PATCH] drivers: disk: nvme: fix warnings There are warnings generated within NVMe. `prp` is a `void *` which is 32bits wide on 32bit systems. This adds a cast to first cast it to a `uintptr_t` and then casts it to a `uint64_t` to supress the warning. This also fix an issue where `int n_prp` is defined under a case statement. This adds the { } around the block underneath it. Signed-off-by: Ryan McClelland --- drivers/disk/nvme/nvme_cmd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/disk/nvme/nvme_cmd.c b/drivers/disk/nvme/nvme_cmd.c index 519250cad1a..0873e9a4aa8 100644 --- a/drivers/disk/nvme/nvme_cmd.c +++ b/drivers/disk/nvme/nvme_cmd.c @@ -555,9 +555,9 @@ static int nvme_cmd_qpair_fill_prp_list(struct nvme_cmd_qpair *qpair, p_addr = (uintptr_t)request->payload; request->cmd.dptr.prp1 = - (uint64_t)sys_cpu_to_le64(p_addr); + sys_cpu_to_le64((uint64_t)p_addr); request->cmd.dptr.prp2 = - (uint64_t)sys_cpu_to_le64(&prp_list->prp); + sys_cpu_to_le64((uint64_t)(uintptr_t)&prp_list->prp); p_addr = NVME_PRP_NEXT_PAGE(p_addr); for (idx = 0; idx < n_prp; idx++) { @@ -602,7 +602,7 @@ static int nvme_cmd_qpair_fill_dptr(struct nvme_cmd_qpair *qpair, switch (request->type) { case NVME_REQUEST_NULL: break; - case NVME_REQUEST_VADDR: + case NVME_REQUEST_VADDR: { int n_prp; if (request->payload_size > qpair->ctrlr->max_xfer_size) { @@ -614,7 +614,7 @@ static int nvme_cmd_qpair_fill_dptr(struct nvme_cmd_qpair *qpair, request->payload_size); if (n_prp <= 2) { request->cmd.dptr.prp1 = - (uint64_t)sys_cpu_to_le64(request->payload); + sys_cpu_to_le64((uint64_t)(uintptr_t)request->payload); if (n_prp == 2) { request->cmd.dptr.prp2 = (uint64_t)sys_cpu_to_le64( NVME_PRP_NEXT_PAGE( @@ -627,6 +627,7 @@ static int nvme_cmd_qpair_fill_dptr(struct nvme_cmd_qpair *qpair, } return nvme_cmd_qpair_fill_prp_list(qpair, request, n_prp); + } default: break; }