Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: nand: brcmnand: return error code of nand_scan_ident/tail() on error

The nand_scan_ident/tail() 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>

authored by

Masahiro Yamada and committed by
Boris Brezillon
c25cca03 b5169d35

+6 -4
+6 -4
drivers/mtd/nand/brcmnand/brcmnand.c
··· 2209 2209 nand_writereg(ctrl, cfg_offs, 2210 2210 nand_readreg(ctrl, cfg_offs) & ~CFG_BUS_WIDTH); 2211 2211 2212 - if (nand_scan_ident(mtd, 1, NULL)) 2213 - return -ENXIO; 2212 + ret = nand_scan_ident(mtd, 1, NULL); 2213 + if (ret) 2214 + return ret; 2214 2215 2215 2216 chip->options |= NAND_NO_SUBPAGE_WRITE; 2216 2217 /* ··· 2235 2234 if (ret) 2236 2235 return ret; 2237 2236 2238 - if (nand_scan_tail(mtd)) 2239 - return -ENXIO; 2237 + ret = nand_scan_tail(mtd); 2238 + if (ret) 2239 + return ret; 2240 2240 2241 2241 return mtd_device_register(mtd, NULL, 0); 2242 2242 }