浏览代码

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@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Brian Norris 9 年之前
父节点
当前提交
2d3743944a
共有 1 个文件被更改,包括 4 次插入8 次删除
  1. 4 8
      drivers/mtd/nand/docg4.c

+ 4 - 8
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);