* [PATCH] mtip32xx: fix error handling in mtip_init()
@ 2012-04-05 10:55 Ryosuke Saito
2012-04-05 14:09 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Ryosuke Saito @ 2012-04-05 10:55 UTC (permalink / raw)
To: axboe; +Cc: asamymuthupa, sbradshaw, dan.carpenter, linux-kernel
Sweep registered blkdev when pci_register_driver has failed.
Signed-off-by: Ryosuke Saito <raitosyo@gmail.com>
---
drivers/block/mtip32xx/mtip32xx.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 8eb81c9..1000d19 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -3608,18 +3608,25 @@ MODULE_DEVICE_TABLE(pci, mtip_pci_tbl);
*/
static int __init mtip_init(void)
{
+ int error;
+
printk(KERN_INFO MTIP_DRV_NAME " Version " MTIP_DRV_VERSION "\n");
/* Allocate a major block device number to use with this driver. */
- mtip_major = register_blkdev(0, MTIP_DRV_NAME);
- if (mtip_major < 0) {
+ error = register_blkdev(0, MTIP_DRV_NAME);
+ if (error <= 0) {
printk(KERN_ERR "Unable to register block device (%d)\n",
- mtip_major);
+ error);
return -EBUSY;
}
+ mtip_major = error;
/* 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;
}
/*
--
1.7.9.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mtip32xx: fix error handling in mtip_init()
2012-04-05 10:55 [PATCH] mtip32xx: fix error handling in mtip_init() Ryosuke Saito
@ 2012-04-05 14:09 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2012-04-05 14:09 UTC (permalink / raw)
To: Ryosuke Saito; +Cc: asamymuthupa, sbradshaw, dan.carpenter, linux-kernel
On 2012-04-05 04:55, Ryosuke Saito wrote:
> Sweep registered blkdev when pci_register_driver has failed.
Thanks, applied.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-04-05 14:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-05 10:55 [PATCH] mtip32xx: fix error handling in mtip_init() Ryosuke Saito
2012-04-05 14:09 ` Jens Axboe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.