Commit ac6c30ad authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

xhci: fix placement of call to usb_disabled()

In the backport of 1eaf35e4, the call to
usb_disabled() was too late, after we had already done some allocation.
Move that call to the top of the function instead, making the logic
match what is intended and is in the original patch.
Reported-by: default avatarLuis Henriques <luis.henriques@canonical.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 757bcff7
...@@ -4866,6 +4866,9 @@ static int __init xhci_hcd_init(void) ...@@ -4866,6 +4866,9 @@ static int __init xhci_hcd_init(void)
{ {
int retval; int retval;
if (usb_disabled())
return -ENODEV;
retval = xhci_register_pci(); retval = xhci_register_pci();
if (retval < 0) { if (retval < 0) {
pr_debug("Problem registering PCI driver.\n"); pr_debug("Problem registering PCI driver.\n");
...@@ -4894,9 +4897,6 @@ static int __init xhci_hcd_init(void) ...@@ -4894,9 +4897,6 @@ static int __init xhci_hcd_init(void)
/* xhci_run_regs has eight fields and embeds 128 xhci_intr_regs */ /* xhci_run_regs has eight fields and embeds 128 xhci_intr_regs */
BUILD_BUG_ON(sizeof(struct xhci_run_regs) != (8+8*128)*32/8); BUILD_BUG_ON(sizeof(struct xhci_run_regs) != (8+8*128)*32/8);
if (usb_disabled())
return -ENODEV;
return 0; return 0;
unreg_pci: unreg_pci:
xhci_unregister_pci(); xhci_unregister_pci();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment