mtd: nand: denali: return error code from nand_scan_ident/tail on error
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Wed, 9 Nov 2016 04:35:28 +0000 (13:35 +0900)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Sat, 19 Nov 2016 08:40:41 +0000 (09:40 +0100)
The nand_scan_ident/tail() returns an appropriate error value when
it fails.  Use it instead of the fixed -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/denali.c

index f636ac4222d040265c67e7a30656e0af0f775c23..bcb2bc79f0a1c98af9d1d375ac8bda8b72eb7030 100644 (file)
@@ -1474,10 +1474,9 @@ int denali_init(struct denali_nand_info *denali)
         * this is the first stage in a two step process to register
         * with the nand subsystem
         */
-       if (nand_scan_ident(mtd, denali->max_banks, NULL)) {
-               ret = -ENXIO;
+       ret = nand_scan_ident(mtd, denali->max_banks, NULL);
+       if (ret)
                goto failed_req_irq;
-       }
 
        /* allocate the right size buffer now */
        devm_kfree(denali->dev, denali->buf.buf);
@@ -1580,10 +1579,9 @@ int denali_init(struct denali_nand_info *denali)
        denali->nand.ecc.write_oob = denali_write_oob;
        denali->nand.erase = denali_erase;
 
-       if (nand_scan_tail(mtd)) {
-               ret = -ENXIO;
+       ret = nand_scan_tail(mtd);
+       if (ret)
                goto failed_req_irq;
-       }
 
        ret = mtd_device_register(mtd, NULL, 0);
        if (ret) {