]> git.karo-electronics.de Git - linux-beck.git/commitdiff
NVMe: Fix nvme module init when nvme_major is set
authorKeith Busch <keith.busch@intel.com>
Wed, 25 Jul 2012 22:05:18 +0000 (16:05 -0600)
committerMatthew Wilcox <matthew.r.wilcox@intel.com>
Thu, 26 Jul 2012 16:23:38 +0000 (12:23 -0400)
register_blkdev returns 0 when given a valid major number.

Reported-by:Ross Zwisler <ross.zwisler@intel.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
drivers/block/nvme.c

index 38b9c73f6706bcea94d045453f040a0dbcc317fd..46e33eec629817ca4cae72ac800c31a096bc8e6b 100644 (file)
@@ -1716,9 +1716,11 @@ static int __init nvme_init(void)
        if (IS_ERR(nvme_thread))
                return PTR_ERR(nvme_thread);
 
-       nvme_major = register_blkdev(nvme_major, "nvme");
-       if (nvme_major <= 0)
+       result = register_blkdev(nvme_major, "nvme");
+       if (result < 0)
                goto kill_kthread;
+       else if (result > 0)
+           nvme_major = result;
 
        result = pci_register_driver(&nvme_driver);
        if (result)