]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
xhci: refuse loading if nousb is used
authorOliver Neukum <oneukum@suse.com>
Thu, 3 Dec 2015 14:03:34 +0000 (15:03 +0100)
committerLuis Henriques <luis.henriques@canonical.com>
Tue, 2 Feb 2016 17:36:00 +0000 (17:36 +0000)
commit 1eaf35e4dd592c59041bc1ed3248c46326da1f5f upstream.

The module should fail to load.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ luis: backported to 3.16:
  - moved usb_disabled() check to the top of the function so that there's
    no need to invoke xhci_unregister_pci() before returning.  Suggested
    by gregkh. ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/usb/host/xhci.c

index 20209e870a993ab1ead028923eb2036f6e14c06e..d9dd9264f8135c1f4c34f95d8df392b4df44e895 100644 (file)
@@ -4928,6 +4928,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");
@@ -4955,6 +4958,7 @@ static int __init xhci_hcd_init(void)
        BUILD_BUG_ON(sizeof(struct xhci_intr_reg) != 8*32/8);
        /* 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);
+
        return 0;
 unreg_pci:
        xhci_unregister_pci();