diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 899c0effb5d3..f054e262176c 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -2380,6 +2380,17 @@ static int xhci_check_bw_table(struct xhci_hcd *xhci, } bw_table = virt_dev->bw_table; + + /* second line of defense, this should not happen if bw_table + is not initialized this calculation should not be called + any issue with bw_table is supposed to be handled earlier + */ + if (bw_table == NULL) { + xhci_warn(xhci, "bw_table == NULL, this should not happen\n" + "please report\n"); + return -ENOMEM; + } + /* We need to translate the max packet size and max ESIT payloads into * the units the hardware uses. */