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

index a65e4e0f57a1c87b7eee27ea98992ed8ff0a5c57..594b28684138f1e25f5949214ffc5a68202506a0 100644 (file)
@@ -242,10 +242,9 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr)
        }
 
        /* Scan to find existence of the device */
-       if (nand_scan(new_mtd, 1)) {
-               err = -ENXIO;
+       err = nand_scan(new_mtd, 1);
+       if (err)
                goto out_free;
-       }
 
        cs553x_mtd[cs] = new_mtd;
        goto out;