Skip to content

Commit 8c1600d

Browse files
Mathias Nymanfrank-w
authored andcommitted
usb: xhci: fix maximum event ring segments calculation
The migration to FIELD_GET introduced an incorrect bit shift. Instead of raising 2 to the power of the register value, the code incorrectly used a static shift of 2 (<< 2). This severely limits the maximum event ring segments on modern controllers. Fix this by converting the FIELD_GET result to a proper power of two using the BIT() macro. Signed-off-by: Mathias Nyman <mathias.nyman@://intel.com>
1 parent 2fbf464 commit 8c1600d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/usb/host/xhci-mem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2301,7 +2301,7 @@ xhci_alloc_interrupter(struct xhci_hcd *xhci, unsigned int segs, gfp_t flags)
23012301
if (!segs)
23022302
segs = ERST_DEFAULT_SEGS;
23032303

2304-
max_segs = FIELD_GET(HCS_ERST_MAX, xhci->hcs_params2) << 2;
2304+
max_segs = BIT(FIELD_GET(HCS_ERST_MAX, xhci->hcs_params2));
23052305
segs = min(segs, max_segs);
23062306

23072307
ir = kzalloc_node(sizeof(*ir), flags, dev_to_node(dev));

0 commit comments

Comments
 (0)