Skip to content

Commit

Permalink
NVMe: Fix nvme module init when nvme_major is set
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Keith Busch authored and Matthew Wilcox committed Jul 26, 2012
1 parent e9ef463 commit 5c42ea1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/block/nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5c42ea1

Please sign in to comment.