sst-linux/drivers/usb/host
Niklas Neronin 1c80787ecd usb: xhci: correct debug message page size calculation
[ Upstream commit 55741c723318905e6d5161bf1e12749020b161e3 ]

The ffs() function returns the index of the first set bit, starting from 1.
If no bits are set, it returns zero. This behavior causes an off-by-one
page size in the debug message, as the page size calculation [1]
is zero-based, while ffs() is one-based.

Fix this by subtracting one from the result of ffs(). Note that since
variable 'val' is unsigned, subtracting one from zero will result in the
maximum unsigned integer value. Consequently, the condition 'if (val < 16)'
will still function correctly.

[1], Page size: (2^(n+12)), where 'n' is the set page size bit.

Fixes: 81720ec532 ("usb: host: xhci: use ffs() in xhci_mem_init()")
Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20250306144954.3507700-9-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-04-10 14:33:36 +02:00
..
bcma-hcd.c
ehci-atmel.c
ehci-brcm.c
ehci-dbg.c
ehci-exynos.c
ehci-fsl.c
ehci-fsl.h
ehci-grlib.c
ehci-hcd.c usb: ehci: add workaround for chipidea PORTSC.PEC bug 2023-09-23 11:11:07 +02:00
ehci-hub.c usb: ehci: add workaround for chipidea PORTSC.PEC bug 2023-09-23 11:11:07 +02:00
ehci-mem.c
ehci-mv.c
ehci-npcm7xx.c
ehci-omap.c
ehci-orion.c
ehci-pci.c
ehci-platform.c
ehci-ppc-of.c
ehci-ps3.c
ehci-q.c
ehci-sched.c
ehci-sh.c usb: ehci-hcd: fix call balance of clocks handling routines 2024-12-19 18:08:49 +01:00
ehci-spear.c usb: ehci-spear: fix call balance of sehci clk handling routines 2024-12-14 19:53:55 +01:00
ehci-st.c
ehci-sysfs.c
ehci-timer.c
ehci-xilinx-of.c
ehci.h usb: ehci: add workaround for chipidea PORTSC.PEC bug 2023-09-23 11:11:07 +02:00
fhci-dbg.c
fhci-hcd.c
fhci-hub.c
fhci-mem.c
fhci-q.c
fhci-sched.c
fhci-tds.c
fhci.h
fotg210-hcd.c usb: fotg210-hcd: delete an incorrect bounds test 2024-01-05 15:18:37 +01:00
fotg210.h
fsl-mph-dr-of.c
isp116x-hcd.c
isp116x.h
isp1362-hcd.c
isp1362.h
Kconfig
Makefile
max3421-hcd.c usb: host: max3421-hcd: Correctly abort a USB request. 2024-12-19 18:08:48 +01:00
octeon-hcd.c
octeon-hcd.h
ohci-at91.c
ohci-da8xx.c
ohci-dbg.c
ohci-exynos.c
ohci-hcd.c usb: ohci: Prevent missed ohci interrupts 2024-05-17 11:56:17 +02:00
ohci-hub.c
ohci-mem.c
ohci-nxp.c
ohci-omap.c
ohci-pci.c
ohci-platform.c
ohci-ppc-of.c
ohci-ps3.c
ohci-pxa27x.c
ohci-q.c
ohci-s3c2410.c
ohci-sa1111.c
ohci-sm501.c
ohci-spear.c
ohci-st.c
ohci-tmio.c
ohci.h
oxu210hp-hcd.c
pci-quirks.c USB: pci-quirks: Fix HCCPARAMS register error for LS7A EHCI 2025-02-21 13:50:02 +01:00
pci-quirks.h
r8a66597-hcd.c
r8a66597.h
sl811_cs.c
sl811-hcd.c usb: sl811-hcd: only defined function checkdone if QUIRK2 is defined 2024-04-13 13:05:18 +02:00
sl811.h
ssb-hcd.c
u132-hcd.c
uhci-debug.c
uhci-grlib.c
uhci-hcd.c
uhci-hcd.h
uhci-hub.c
uhci-pci.c
uhci-platform.c
uhci-q.c
xen-hcd.c
xhci-caps.h XHCI: Separate PORT and CAPs macros into dedicated file 2024-11-01 01:56:02 +01:00
xhci-dbg.c
xhci-dbgcap.c xhci: dbc: Fix STALL transfer event handling 2024-12-14 19:54:52 +01:00
xhci-dbgcap.h xhci: dbc: Fix STALL transfer event handling 2024-12-14 19:54:52 +01:00
xhci-dbgtty.c xhci: dbc: honor usb transfer size boundaries. 2024-11-01 01:56:01 +01:00
xhci-debugfs.c xhci: Refactor interrupter code for initial multi interrupter support. 2024-10-17 15:21:25 +02:00
xhci-debugfs.h
xhci-ext-caps.c
xhci-ext-caps.h
xhci-histb.c
xhci-hub.c
xhci-mem.c usb: xhci: correct debug message page size calculation 2025-04-10 14:33:36 +02:00
xhci-mtk-sch.c
xhci-mtk.c usb: xhci-mtk: fix a short packet issue of gen1 isoc-in transfer 2024-01-25 15:27:48 -08:00
xhci-mtk.h usb: xhci-mtk: fix a short packet issue of gen1 isoc-in transfer 2024-01-25 15:27:48 -08:00
xhci-mvebu.c
xhci-mvebu.h
xhci-pci-renesas.c
xhci-pci.c usb: xhci: Enable the TRB overfetch quirk on VIA VL805 2025-03-13 12:53:21 +01:00
xhci-pci.h
xhci-plat.c usb: host: xhci-plat: Add support for XHCI_SG_TRB_CACHE_SIZE_QUIRK 2024-02-16 19:06:30 +01:00
xhci-plat.h usb: xhci-plat: Don't include xhci.h 2024-05-17 11:56:18 +02:00
xhci-port.h XHCI: Separate PORT and CAPs macros into dedicated file 2024-11-01 01:56:02 +01:00
xhci-rcar.c
xhci-rcar.h
xhci-ring.c usb: xhci: Fix NULL pointer dereference on certain command aborts 2025-02-21 13:49:26 +01:00
xhci-tegra.c Revert "usb: xhci: tegra: Fix error check" 2023-08-03 10:24:11 +02:00
xhci-trace.c
xhci-trace.h
xhci.c usb: xhci: Avoid queuing redundant Stop Endpoint commands 2025-01-09 13:30:05 +01:00
xhci.h usb: xhci: Enable the TRB overfetch quirk on VIA VL805 2025-03-13 12:53:21 +01:00