diff mbox series

usb: host: xhci: fix coverity checker CONSTANT_EXPRESSION_RESULT warning

Message ID 20230705105743.553052-1-jun.li@nxp.com
State New
Headers show
Series usb: host: xhci: fix coverity checker CONSTANT_EXPRESSION_RESULT warning | expand

Commit Message

Jun Li July 5, 2023, 10:57 a.m. UTC
CID 28889612: Operands don't affect result (CONSTANT_EXPRESSION_RESULT)
result_independent_of_operands: urb->transfer_dma >> 16 >> 16 is 0
regardless of the values of its operands. This occurs as an argument
to a function call.

So convert the dma address to be u64 when extract its upper 32 bits.

Signed-off-by: Li Jun <jun.li@nxp.com>
---
 drivers/usb/host/xhci-ring.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 646ff125def5..847a1eadd17a 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -747,7 +747,7 @@  static int xhci_move_dequeue_past_td(struct xhci_hcd *xhci,
 		trb_sct = SCT_FOR_TRB(SCT_PRI_TR);
 	ret = queue_command(xhci, cmd,
 		lower_32_bits(addr) | trb_sct | new_cycle,
-		upper_32_bits(addr),
+		upper_32_bits((u64) addr),
 		STREAM_ID_FOR_TRB(stream_id), SLOT_ID_FOR_TRB(slot_id) |
 		EP_ID_FOR_TRB(ep_index) | TRB_TYPE(TRB_SET_DEQ), false);
 	if (ret < 0) {
@@ -4347,7 +4347,7 @@  int xhci_queue_address_device(struct xhci_hcd *xhci, struct xhci_command *cmd,
 		dma_addr_t in_ctx_ptr, u32 slot_id, enum xhci_setup_dev setup)
 {
 	return queue_command(xhci, cmd, lower_32_bits(in_ctx_ptr),
-			upper_32_bits(in_ctx_ptr), 0,
+			upper_32_bits((u64) in_ctx_ptr), 0,
 			TRB_TYPE(TRB_ADDR_DEV) | SLOT_ID_FOR_TRB(slot_id)
 			| (setup == SETUP_CONTEXT_ONLY ? TRB_BSR : 0), false);
 }
@@ -4373,7 +4373,7 @@  int xhci_queue_configure_endpoint(struct xhci_hcd *xhci,
 		u32 slot_id, bool command_must_succeed)
 {
 	return queue_command(xhci, cmd, lower_32_bits(in_ctx_ptr),
-			upper_32_bits(in_ctx_ptr), 0,
+			upper_32_bits((u64) in_ctx_ptr), 0,
 			TRB_TYPE(TRB_CONFIG_EP) | SLOT_ID_FOR_TRB(slot_id),
 			command_must_succeed);
 }
@@ -4383,7 +4383,7 @@  int xhci_queue_evaluate_context(struct xhci_hcd *xhci, struct xhci_command *cmd,
 		dma_addr_t in_ctx_ptr, u32 slot_id, bool command_must_succeed)
 {
 	return queue_command(xhci, cmd, lower_32_bits(in_ctx_ptr),
-			upper_32_bits(in_ctx_ptr), 0,
+			upper_32_bits((u64) in_ctx_ptr), 0,
 			TRB_TYPE(TRB_EVAL_CONTEXT) | SLOT_ID_FOR_TRB(slot_id),
 			command_must_succeed);
 }