This patch handles blk_register_region() return value. Earlier blk_register_region() function doesn't handle error cases, now it is added, so the callers of this function should also handle it. Verfied on X86 based ubuntu machine. This patch depends on [PATCH 1/8] block/genhd.c: Add error handling Signed-off-by: Vishnu Pratap Singh <vishnu.ps@xxxxxxxxxxx> --- drivers/md/md.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index a71b36f..244bb26 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -8940,10 +8940,12 @@ static int __init md_init(void) goto err_mdp; mdp_major = ret; - blk_register_region(MKDEV(MD_MAJOR, 0), 512, THIS_MODULE, - md_probe, NULL, NULL); - blk_register_region(MKDEV(mdp_major, 0), 1UL<<MINORBITS, THIS_MODULE, - md_probe, NULL, NULL); + if (blk_register_region(MKDEV(MD_MAJOR, 0), 512, THIS_MODULE, + md_probe, NULL, NULL)) + goto err_md_blk; + if (blk_register_region(MKDEV(mdp_major, 0), 1UL<<MINORBITS, + THIS_MODULE, md_probe, NULL, NULL)) + goto err_mdp_blk; register_reboot_notifier(&md_notifier); raid_table_header = register_sysctl_table(raid_root_table); @@ -8951,6 +8953,10 @@ static int __init md_init(void) md_geninit(); return 0; +err_mdp_blk: + blk_unregister_region(MKDEV(MD_MAJOR, 0), 512); +err_md_blk: + unregister_blkdev(MD_MAJOR, "mdp"); err_mdp: unregister_blkdev(MD_MAJOR, "md"); err_md: -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html