Commit da3962fe authored by Akinobu Mita's avatar Akinobu Mita Committed by James Bottomley

[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: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent a5785037
...@@ -885,7 +885,11 @@ static int __init init_sr(void) ...@@ -885,7 +885,11 @@ static int __init init_sr(void)
rc = register_blkdev(SCSI_CDROM_MAJOR, "sr"); rc = register_blkdev(SCSI_CDROM_MAJOR, "sr");
if (rc) if (rc)
return 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) static void __exit exit_sr(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment