Skip to contentSkip to conversation

xhci: omit mem read just after allocation of trb

PATCH In review Oliver Neukum 3 participants 3 messages Feb 17, 2022 – Feb 24, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xhci: omit mem read just after allocation of trb

This has been allocated just a few lines earlier with a zalloc(). The value is known and "|=" is a waste of memory cycles.

---
 drivers/usb/host/xhci-mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-mem.c +1 -1
index 0e312066c5c6..99a3ce689235 100644
@@ -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 (cycle_state == 0) {
 		for (i = 0; i < TRBS_PER_SEGMENT; i++)
-			seg->trbs[i].link.control |= cpu_to_le32(TRB_CYCLE);
+			seg->trbs[i].link.control = cpu_to_le32(TRB_CYCLE);
 	}
 	seg->dma = dma;
 	seg->next = NULL;
Signature · 1 line
2.34.1
maintainer
#2 lore raw
Quoted 11 lines · Mathias Nyman
Quoted 5 lines · Oliver Neukum

This has been allocated just a few lines earlier with a zalloc(). The value is known and "|=" is a waste of memory cycles.

Thanks

In case Greg wants to pick this up now directly:

Thanks, I'll take it now, it's easy enough to :)