Commit 2d374394 authored by Brian Norris's avatar Brian Norris

mtd: nand: docg4: simplify error case

Other refactorings have left the 'fail' label much simpler, so it
shouldn't have to handle the failed allocation case.

This also fixes a -Wshadow warning.
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
Reviewed-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
parent 7208b997
...@@ -1353,14 +1353,10 @@ static int __init probe_docg4(struct platform_device *pdev) ...@@ -1353,14 +1353,10 @@ static int __init probe_docg4(struct platform_device *pdev)
doc->mtd = mtd; doc->mtd = mtd;
return 0; return 0;
fail: fail:
if (nand) {
/* re-declarations avoid compiler warning */
struct docg4_priv *doc = nand->priv;
nand_release(mtd); /* deletes partitions and mtd devices */ nand_release(mtd); /* deletes partitions and mtd devices */
free_bch(doc->bch); free_bch(doc->bch);
kfree(nand); kfree(nand);
}
fail_unmap: fail_unmap:
iounmap(virtadr); iounmap(virtadr);
......
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