提交 6d27f09a 编写于 作者: R Ryosuke Saito 提交者: Jens Axboe

mtip32xx: fix error handling in mtip_init()

Ensure that block device is properly unregistered, if
pci_register_driver() fails.
Signed-off-by: NRyosuke Saito <raitosyo@gmail.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 e9986f30
...@@ -3605,18 +3605,25 @@ MODULE_DEVICE_TABLE(pci, mtip_pci_tbl); ...@@ -3605,18 +3605,25 @@ MODULE_DEVICE_TABLE(pci, mtip_pci_tbl);
*/ */
static int __init mtip_init(void) static int __init mtip_init(void)
{ {
int error;
printk(KERN_INFO MTIP_DRV_NAME " Version " MTIP_DRV_VERSION "\n"); printk(KERN_INFO MTIP_DRV_NAME " Version " MTIP_DRV_VERSION "\n");
/* Allocate a major block device number to use with this driver. */ /* Allocate a major block device number to use with this driver. */
mtip_major = register_blkdev(0, MTIP_DRV_NAME); error = register_blkdev(0, MTIP_DRV_NAME);
if (mtip_major < 0) { if (error <= 0) {
printk(KERN_ERR "Unable to register block device (%d)\n", printk(KERN_ERR "Unable to register block device (%d)\n",
mtip_major); error);
return -EBUSY; return -EBUSY;
} }
mtip_major = error;
/* Register our PCI operations. */ /* Register our PCI operations. */
return pci_register_driver(&mtip_pci_driver); error = pci_register_driver(&mtip_pci_driver);
if (error)
unregister_blkdev(mtip_major, MTIP_DRV_NAME);
return error;
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册