]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
mmc_block: handle error from mmc_register_driver()
authorAkinobu Mita <akinobu.mita@gmail.com>
Sat, 13 Sep 2008 10:02:07 +0000 (19:02 +0900)
committerPierre Ossman <drzeus@drzeus.cx>
Sat, 20 Sep 2008 11:03:26 +0000 (13:03 +0200)
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>
drivers/mmc/card/block.c

index 86dbb366415a14a76b3961180cd3f14176f911cc..43d9a5b53e8d3a9d9bb7dcfee6ac95626749844f 100644 (file)
@@ -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;
 }