提交 da3962fe 编写于 作者: A Akinobu Mita 提交者: 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: NAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
上级 a5785037
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册