mtd: nand: pasemi: return error code of nand_scan() on error
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 4 Nov 2016 10:42:56 +0000 (19:42 +0900)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Mon, 7 Nov 2016 13:48:45 +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/pasemi_nand.c

index 5de7591b05106bcbf172ad3bc3c6c8013c8b4c32..074b8b01289e185bc153135ee9be79c933920bcc 100644 (file)
@@ -156,10 +156,9 @@ static int pasemi_nand_probe(struct platform_device *ofdev)
        chip->bbt_options = NAND_BBT_USE_FLASH;
 
        /* Scan to find existence of the device */
-       if (nand_scan(pasemi_nand_mtd, 1)) {
-               err = -ENXIO;
+       err = nand_scan(pasemi_nand_mtd, 1);
+       if (err)
                goto out_lpc;
-       }
 
        if (mtd_device_register(pasemi_nand_mtd, NULL, 0)) {
                dev_err(dev, "Unable to register MTD device\n");