mtd: nand: docg4: simplify error case

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue Jan 12 15:59:24 PST 2016


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=2d3743944a6b425f3a3795a967499c13e0d8856c
Commit:     2d3743944a6b425f3a3795a967499c13e0d8856c
Parent:     7208b997b726522cdbea61f53a82c763704c015a
Author:     Brian Norris <computersforpeace at gmail.com>
AuthorDate: Fri Dec 18 11:39:53 2015 -0800
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Fri Dec 18 12:43:00 2015 -0800

    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 <computersforpeace at gmail.com>
    Reviewed-by: Boris Brezillon <boris.brezillon at free-electrons.com>
---
 drivers/mtd/nand/docg4.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/nand/docg4.c b/drivers/mtd/nand/docg4.c
index cb6efad..24d478d 100644
--- a/drivers/mtd/nand/docg4.c
+++ b/drivers/mtd/nand/docg4.c
@@ -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);



More information about the linux-mtd-cvs mailing list