Skip to content

Commit 05db156

Browse files
XenuIsWatchingkartben
authored andcommitted
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 <[email protected]>
1 parent 2b5c274 commit 05db156

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/disk/nvme/nvme_cmd.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -555,9 +555,9 @@ static int nvme_cmd_qpair_fill_prp_list(struct nvme_cmd_qpair *qpair,
555555

556556
p_addr = (uintptr_t)request->payload;
557557
request->cmd.dptr.prp1 =
558-
(uint64_t)sys_cpu_to_le64(p_addr);
558+
sys_cpu_to_le64((uint64_t)p_addr);
559559
request->cmd.dptr.prp2 =
560-
(uint64_t)sys_cpu_to_le64(&prp_list->prp);
560+
sys_cpu_to_le64((uint64_t)(uintptr_t)&prp_list->prp);
561561
p_addr = NVME_PRP_NEXT_PAGE(p_addr);
562562

563563
for (idx = 0; idx < n_prp; idx++) {
@@ -602,7 +602,7 @@ static int nvme_cmd_qpair_fill_dptr(struct nvme_cmd_qpair *qpair,
602602
switch (request->type) {
603603
case NVME_REQUEST_NULL:
604604
break;
605-
case NVME_REQUEST_VADDR:
605+
case NVME_REQUEST_VADDR: {
606606
int n_prp;
607607

608608
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,
614614
request->payload_size);
615615
if (n_prp <= 2) {
616616
request->cmd.dptr.prp1 =
617-
(uint64_t)sys_cpu_to_le64(request->payload);
617+
sys_cpu_to_le64((uint64_t)(uintptr_t)request->payload);
618618
if (n_prp == 2) {
619619
request->cmd.dptr.prp2 = (uint64_t)sys_cpu_to_le64(
620620
NVME_PRP_NEXT_PAGE(
@@ -627,6 +627,7 @@ static int nvme_cmd_qpair_fill_dptr(struct nvme_cmd_qpair *qpair,
627627
}
628628

629629
return nvme_cmd_qpair_fill_prp_list(qpair, request, n_prp);
630+
}
630631
default:
631632
break;
632633
}

0 commit comments

Comments
 (0)