Sweep registered blkdev when scsi_register_driver has failed. Cc: Jens Axboe <jens.axboe@xxxxxxxxxx> Signed-off-by: Akinobu Mita <akinobu.mita@xxxxxxxxx> Index: 2.6-rc/drivers/scsi/sr.c =================================================================== --- 2.6-rc.orig/drivers/scsi/sr.c +++ 2.6-rc/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) - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html