Skip to content

Commit

Permalink
mmc_block: handle error from mmc_register_driver()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mita authored and Pierre Ossman committed Sep 20, 2008
1 parent da45b66 commit 9d4e98e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/mmc/card/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 9d4e98e

Please sign in to comment.