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

mtd: nand: omap2: 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
bd93a3af bc83c788

+4 -5
+4 -5
drivers/mtd/nand/omap2.c
··· 1895 1895 1896 1896 /* scan NAND device connected to chip controller */ 1897 1897 nand_chip->options |= info->devsize & NAND_BUSWIDTH_16; 1898 - if (nand_scan_ident(mtd, 1, NULL)) { 1898 + err = nand_scan_ident(mtd, 1, NULL); 1899 + if (err) { 1899 1900 dev_err(&info->pdev->dev, 1900 1901 "scan failed, may be bus-width mismatch\n"); 1901 - err = -ENXIO; 1902 1902 goto return_error; 1903 1903 } 1904 1904 ··· 2154 2154 2155 2155 scan_tail: 2156 2156 /* second phase scan */ 2157 - if (nand_scan_tail(mtd)) { 2158 - err = -ENXIO; 2157 + err = nand_scan_tail(mtd); 2158 + if (err) 2159 2159 goto return_error; 2160 - } 2161 2160 2162 2161 if (dev->of_node) 2163 2162 mtd_device_register(mtd, NULL, 0);