Skip to contentSkip to conversation

usb: chipidea: udc: fix the ENDIAN issue

PATCH New Peter Chen 1 participant 1 message Jun 10, 2020

Subsystems (2)
lore
Share & tools
lore

Peter Chen

author maintainer
#0 lore raw

PATCH 1/1 usb: chipidea: udc: fix the ENDIAN issue

From: Peter Chen <[email protected]>

Fix the ENDIAN issue when assign dTD entry.

---
 drivers/usb/chipidea/udc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/chipidea/udc.c +3 -2
index db0cfde0cc3c..ff9de91d98ca 100644
@@ -473,9 +473,10 @@ static void ci_add_buffer_entry(struct td_node *node, struct scatterlist *s)
 	int empty_td_slot_index = (CI_MAX_BUF_SIZE - node->td_remaining_size)
 			/ CI_HDRC_PAGE_SIZE;
 	int i;
+	u32 token;
 
-	node->ptr->token +=
-		cpu_to_le32(sg_dma_len(s) << __ffs(TD_TOTAL_BYTES));
+	token = le32_to_cpu(node->ptr->token) + (sg_dma_len(s) << __ffs(TD_TOTAL_BYTES));
+	node->ptr->token = cpu_to_le32(token);
 
 	for (i = empty_td_slot_index; i < TD_PAGE_COUNT; i++) {
 		u32 page = (u32) sg_dma_address(s) +
Signature · 1 line
2.17.1