提交 58719487 编写于 作者: X Xenia Ragiadakou 提交者: Sarah Sharp

xhci: convert TRB_CYCLE to le32 before using it to set Link TRB's cycle bit

This patch converts TRB_CYCLE to le32 to update correctly the Cycle Bit in
'control' field of the link TRB.
This bug was found using sparse.
Signed-off-by: NXenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
上级 6ce4eac1
...@@ -57,7 +57,7 @@ static struct xhci_segment *xhci_segment_alloc(struct xhci_hcd *xhci, ...@@ -57,7 +57,7 @@ static struct xhci_segment *xhci_segment_alloc(struct xhci_hcd *xhci,
/* If the cycle state is 0, set the cycle bit to 1 for all the TRBs */ /* If the cycle state is 0, set the cycle bit to 1 for all the TRBs */
if (cycle_state == 0) { if (cycle_state == 0) {
for (i = 0; i < TRBS_PER_SEGMENT; i++) for (i = 0; i < TRBS_PER_SEGMENT; i++)
seg->trbs[i].link.control |= TRB_CYCLE; seg->trbs[i].link.control |= cpu_to_le32(TRB_CYCLE);
} }
seg->dma = dma; seg->dma = dma;
seg->next = NULL; seg->next = NULL;
...@@ -308,7 +308,8 @@ static void xhci_reinit_cached_ring(struct xhci_hcd *xhci, ...@@ -308,7 +308,8 @@ static void xhci_reinit_cached_ring(struct xhci_hcd *xhci,
sizeof(union xhci_trb)*TRBS_PER_SEGMENT); sizeof(union xhci_trb)*TRBS_PER_SEGMENT);
if (cycle_state == 0) { if (cycle_state == 0) {
for (i = 0; i < TRBS_PER_SEGMENT; i++) for (i = 0; i < TRBS_PER_SEGMENT; i++)
seg->trbs[i].link.control |= TRB_CYCLE; seg->trbs[i].link.control |=
cpu_to_le32(TRB_CYCLE);
} }
/* All endpoint rings have link TRBs */ /* All endpoint rings have link TRBs */
xhci_link_segments(xhci, seg, seg->next, type); xhci_link_segments(xhci, seg, seg->next, type);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册