Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: xhci: print xhci->xhc_state when queue_command failed

When encounters some errors like these:
xhci_hcd 0000:4a:00.2: xHCI dying or halted, can't queue_command
xhci_hcd 0000:4a:00.2: FIXME: allocate a command ring segment
usb usb5-port6: couldn't allocate usb_device

It's hard to know whether xhc_state is dying or halted. So it's better
to print xhc_state's value which can help locate the resaon of the bug.

Signed-off-by: Su Hui <suhui@nfschina.com>
Link: https://lore.kernel.org/r/20250725060117.1773770-1-suhui@nfschina.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Su Hui and committed by
Greg Kroah-Hartman
7919407e ea83bf05

+2 -1
+2 -1
drivers/usb/host/xhci-ring.c
··· 4375 4375 4376 4376 if ((xhci->xhc_state & XHCI_STATE_DYING) || 4377 4377 (xhci->xhc_state & XHCI_STATE_HALTED)) { 4378 - xhci_dbg(xhci, "xHCI dying or halted, can't queue_command\n"); 4378 + xhci_dbg(xhci, "xHCI dying or halted, can't queue_command. state: 0x%x\n", 4379 + xhci->xhc_state); 4379 4380 return -ESHUTDOWN; 4380 4381 } 4381 4382