mtd: nand: mpc5121: return error code of nand_scan() on error
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 4 Nov 2016 10:42:53 +0000 (19:42 +0900)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Mon, 7 Nov 2016 13:48:43 +0000 (14:48 +0100)
The nand_scan() returns an appropriate error value when it fails.
Use it instead of the fixed error code -ENXIO.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/nand/mpc5121_nfc.c

index 7eacb2f545f50366cc8996d48d3f46aaf9ed195c..6d6eaed2d20c281321df7e3245ab525866eeca80 100644 (file)
@@ -777,9 +777,9 @@ static int mpc5121_nfc_probe(struct platform_device *op)
        }
 
        /* Detect NAND chips */
-       if (nand_scan(mtd, be32_to_cpup(chips_no))) {
+       retval = nand_scan(mtd, be32_to_cpup(chips_no));
+       if (retval) {
                dev_err(dev, "NAND Flash not found !\n");
-               retval = -ENXIO;
                goto error;
        }