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

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/mtk_nand.c

index 5223a21..6c3eed3 100644 (file)
@@ -1297,7 +1297,7 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc,
 
        ret = nand_scan_ident(mtd, nsels, NULL);
        if (ret)
-               return -ENODEV;
+               return ret;
 
        /* store bbt magic in page, cause OOB is not protected */
        if (nand->bbt_options & NAND_BBT_USE_FLASH)
@@ -1323,7 +1323,7 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc,
 
        ret = nand_scan_tail(mtd);
        if (ret)
-               return -ENODEV;
+               return ret;
 
        ret = mtd_device_parse_register(mtd, NULL, NULL, NULL, 0);
        if (ret) {