diff --git a/payloads/libpayload/drivers/usb/xhci.c b/payloads/libpayload/drivers/usb/xhci.c index 6737a140ec..e9a7ead18b 100644 --- a/payloads/libpayload/drivers/usb/xhci.c +++ b/payloads/libpayload/drivers/usb/xhci.c @@ -155,6 +155,9 @@ xhci_init(unsigned long physical_bar) { int i; + if (!physical_bar) + goto _exit_xhci; + /* First, allocate and initialize static controller structures */ hci_t *const controller = new_controller(); @@ -301,6 +304,7 @@ _free_xhci: /* _free_controller: */ detach_controller(controller); free(controller); +_exit_xhci: return NULL; }