Commit 9d4e98e9 authored by Akinobu Mita's avatar Akinobu Mita Committed by Pierre Ossman

mmc_block: handle error from mmc_register_driver()

Check error from mmc_register_driver() and properly unwind
block device registration.
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
parent da45b66e
...@@ -613,14 +613,19 @@ static struct mmc_driver mmc_driver = { ...@@ -613,14 +613,19 @@ static struct mmc_driver mmc_driver = {
static int __init mmc_blk_init(void) static int __init mmc_blk_init(void)
{ {
int res = -ENOMEM; int res;
res = register_blkdev(MMC_BLOCK_MAJOR, "mmc"); res = register_blkdev(MMC_BLOCK_MAJOR, "mmc");
if (res) if (res)
goto out; goto out;
return mmc_register_driver(&mmc_driver); res = mmc_register_driver(&mmc_driver);
if (res)
goto out2;
return 0;
out2:
unregister_blkdev(MMC_BLOCK_MAJOR, "mmc");
out: out:
return res; return res;
} }
......
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