mtd: nand: docg4: simplify error case
Subsystems (2)
PATCH 1/1 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 Brian Norris <[email protected]>
--- drivers/mtd/nand/docg4.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/mtd/nand/docg4.c +4 -8
@@ -1353,14 +1353,10 @@ static int __init probe_docg4(struct platform_device *pdev) doc->mtd = mtd;return 0 ; - fail: -if (nand) { -/* re-declarations avoid compiler warning */ -struct docg4_priv *doc = nand->priv; -nand_release (mtd);/* deletes partitions and mtd devices */ -free_bch (doc->bch); -kfree (nand); - } +fail: +nand_release (mtd);/* deletes partitions and mtd devices */ +free_bch (doc->bch); +kfree (nand); fail_unmap:iounmap (virtadr);
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
Quoted 6 lines · On Fri, 18 Dec 2015 11:39:53 -0800 Brian Norris <[email protected]>…
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 Brian Norris <[email protected]>
Reviewed-by Boris Brezillon <[email protected]>
Quoted 27 lines
--- drivers/mtd/nand/docg4.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)drivers/mtd/nand/docg4.c +4
-8@@ -1353,14 +1353,10 @@ static int __init probe_docg4(struct platform_device *pdev) doc->mtd = mtd;return 0 ; - fail: -if (nand) { -/* re-declarations avoid compiler warning */ -struct docg4_priv *doc = nand->priv; -nand_release (mtd);/* deletes partitions and mtd devices */ -free_bch (doc->bch); -kfree (nand); - } +fail: +nand_release (mtd);/* deletes partitions and mtd devices */ +free_bch (doc->bch); +kfree (nand); fail_unmap:iounmap (virtadr);
Signature · 3 lines
Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Brian Norris
AppliedQuoted 6 lines · Brian Norris
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 Brian Norris <[email protected]>
Applied