usb: xhci: Fix HCS_ERST_MAX conversion

This fixes one broken line in commit 6d45e9556d ("usb: xhci: standardize
multi bit-field macros") included in 7.3-rc1 kernel

HCS_ERST_MAX holds power of 2 value for maximum number of segments.
In the culprit commit, this was incorrectly converted to "shift up 2".
On hardware where this field is zero, this results in xhci_alloc_erst()
calling dma_alloc_coherent() with size = 0, leading to a horrible splat
and non-usable XHCI.

Revert the shift-up-2 to the BIT() macro.

Fixes: 6d45e9556d ("usb: xhci: standardize multi bit-field macros")
Cc: Niklas Neronin <[email protected]>
Signed-off-by: Chen-Yu Tsai <[email protected]>
Signed-off-by: Mathias Nyman <[email protected]>
Tested-by: Pierre-David Belanger <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
Chen-Yu Tsai authored and Greg Kroah-Hartman committed 2026-08-31 11:43:00 +02:00
1 parent cee9395acd
commit 045b5bef91
1 file changed
+1 -1
+1 -1
View File
@@ -2301,7 +2301,7 @@ xhci_alloc_interrupter(struct xhci_hcd *xhci, unsigned int segs, gfp_t flags)
if (!segs)
segs = ERST_DEFAULT_SEGS;
max_segs = FIELD_GET(HCS_ERST_MAX, xhci->hcs_params2) << 2;
max_segs = BIT(FIELD_GET(HCS_ERST_MAX, xhci->hcs_params2));
segs = min(segs, max_segs);
ir = kzalloc_node(sizeof(*ir), flags, dev_to_node(dev));