summaryrefslogtreecommitdiff
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-01-31 11:11:58 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-17 12:34:34 -0800
commitac6c30ade442af72b6359e554ac12d6d836b351d (patch)
tree8c9fb5fb056ded45330f7aaa461e74a8b6cd8664 /drivers/usb/host
parent757bcff73ad4726504a3f40d12a970a593249350 (diff)
downloadlwn-ac6c30ade442af72b6359e554ac12d6d836b351d.tar.gz
lwn-ac6c30ade442af72b6359e554ac12d6d836b351d.zip
xhci: fix placement of call to usb_disabled()
In the backport of 1eaf35e4dd592c59041bc1ed3248c46326da1f5f, 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: Luis Henriques <luis.henriques@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/xhci.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index c8e693c22014..27688e3b0a4c 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4866,6 +4866,9 @@ static int __init xhci_hcd_init(void)
{
int retval;
+ if (usb_disabled())
+ return -ENODEV;
+
retval = xhci_register_pci();
if (retval < 0) {
pr_debug("Problem registering PCI driver.\n");
@@ -4894,9 +4897,6 @@ static int __init xhci_hcd_init(void)
/* 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);
- if (usb_disabled())
- return -ENODEV;
-
return 0;
unreg_pci:
xhci_unregister_pci();