[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1446812535-10567-6-git-send-email-vishnu.ps@samsung.com>
Date: Fri, 06 Nov 2015 17:52:13 +0530
From: Vishnu Pratap Singh <vishnu.ps@...sung.com>
To: axboe@...nel.dk, akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org, jmoyer@...hat.com,
minchan@...nel.org, ngupta@...are.org,
sergey.senozhatsky.work@...il.com, davem@...emloft.net,
neilb@...e.com, ulf.hansson@...aro.org, tiwai@...e.de,
hare@...e.de, ming.lei@...onical.com, jarod@...hat.com,
viro@...iv.linux.org.uk, tj@...nel.org, adrian.hunter@...el.com,
jonathanh@...dia.com, grundler@...omium.org,
linux-ide@...r.kernel.org, linux-raid@...r.kernel.org,
linux-mmc@...r.kernel.org
Cc: cpgs@...sung.com, vishu13285@...il.com, pintu.k@...sung.com,
rohit.kr@...sung.com, Vishnu Pratap Singh <vishnu.ps@...sung.com>
Subject: [PATCH 6/8] md/md.c: handle blk_register_region() return value
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@...sung.com>
---
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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists