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 <ryanmcclelland@meta.com>
This commit is contained in:
Ryan McClelland 2025-04-08 11:08:49 -07:00 committed by Benjamin Cabé
commit 05db1563c5

View file

@ -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;
}