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.masah...@socionext.com>
---

 drivers/mtd/nand/cmx270_nand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/cmx270_nand.c b/drivers/mtd/nand/cmx270_nand.c
index 4913378..226ac0b 100644
--- a/drivers/mtd/nand/cmx270_nand.c
+++ b/drivers/mtd/nand/cmx270_nand.c
@@ -195,9 +195,9 @@ static int __init cmx270_init(void)
        this->write_buf = cmx270_write_buf;
 
        /* Scan to find existence of the device */
-       if (nand_scan (cmx270_nand_mtd, 1)) {
+       ret = nand_scan(cmx270_nand_mtd, 1);
+       if (ret) {
                pr_notice("No NAND device\n");
-               ret = -ENXIO;
                goto err_scan;
        }
 
-- 
1.9.1

Reply via email to