diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2007-06-25 17:39:33 +0200 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-07-15 01:54:34 +0200 |
commit | da3962fe63eae4f490356cb54e4700eac752541b (patch) | |
tree | fe59db896d263abe71f63d90a0e0fd1458edf1c0 /drivers/scsi/sr.c | |
parent | [SCSI] lpfc: Fix NPIV compile problem (diff) | |
download | linux-da3962fe63eae4f490356cb54e4700eac752541b.tar.xz linux-da3962fe63eae4f490356cb54e4700eac752541b.zip |
[SCSI] sr: fix error handling in module_init
Sweep registered blkdev when scsi_register_driver has failed.
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/sr.c')
-rw-r--r-- | drivers/scsi/sr.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index f9a52af7f5b4..5143c8990845 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -885,7 +885,11 @@ static int __init init_sr(void) rc = register_blkdev(SCSI_CDROM_MAJOR, "sr"); if (rc) return rc; - return scsi_register_driver(&sr_template.gendrv); + rc = scsi_register_driver(&sr_template.gendrv); + if (rc) + unregister_blkdev(SCSI_CDROM_MAJOR, "sr"); + + return rc; } static void __exit exit_sr(void) |