diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2008-09-13 19:02:07 +0900 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2008-09-20 13:03:26 +0200 |
commit | 9d4e98e9609bc19d4a8ac4a5c3218358d1820114 (patch) | |
tree | 5b794afb9abc6af1051ce3c9f031034a329b05f0 /drivers/mmc/card | |
parent | da45b66ec89bbf3a1c172688c35d4d3a6e8e757f (diff) | |
download | op-kernel-dev-9d4e98e9609bc19d4a8ac4a5c3218358d1820114.zip op-kernel-dev-9d4e98e9609bc19d4a8ac4a5c3218358d1820114.tar.gz |
mmc_block: handle error from mmc_register_driver()
Check error from mmc_register_driver() and properly unwind
block device registration.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/card')
-rw-r--r-- | drivers/mmc/card/block.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 86dbb36..43d9a5b 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -613,14 +613,19 @@ static struct mmc_driver mmc_driver = { static int __init mmc_blk_init(void) { - int res = -ENOMEM; + int res; res = register_blkdev(MMC_BLOCK_MAJOR, "mmc"); if (res) 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: return res; } |