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

mtd: nand: lpc32xx: 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>
Acked-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>

authored by

Masahiro Yamada and committed by
Boris Brezillon
b04bafca ad5678ec

+8 -12
+4 -6
drivers/mtd/nand/lpc32xx_mlc.c
··· 747 747 * Scan to find existance of the device and 748 748 * Get the type of NAND device SMALL block or LARGE block 749 749 */ 750 - if (nand_scan_ident(mtd, 1, NULL)) { 751 - res = -ENXIO; 750 + res = nand_scan_ident(mtd, 1, NULL); 751 + if (res) 752 752 goto err_exit3; 753 - } 754 753 755 754 host->dma_buf = devm_kzalloc(&pdev->dev, mtd->writesize, GFP_KERNEL); 756 755 if (!host->dma_buf) { ··· 792 793 * Fills out all the uninitialized function pointers with the defaults 793 794 * And scans for a bad block table if appropriate. 794 795 */ 795 - if (nand_scan_tail(mtd)) { 796 - res = -ENXIO; 796 + res = nand_scan_tail(mtd); 797 + if (res) 797 798 goto err_exit4; 798 - } 799 799 800 800 mtd->name = DRV_NAME; 801 801
+4 -6
drivers/mtd/nand/lpc32xx_slc.c
··· 894 894 } 895 895 896 896 /* Find NAND device */ 897 - if (nand_scan_ident(mtd, 1, NULL)) { 898 - res = -ENXIO; 897 + res = nand_scan_ident(mtd, 1, NULL); 898 + if (res) 899 899 goto err_exit3; 900 - } 901 900 902 901 /* OOB and ECC CPU and DMA work areas */ 903 902 host->ecc_buf = (uint32_t *)(host->data_buf + LPC32XX_DMA_DATA_SIZE); ··· 928 929 /* 929 930 * Fills out all the uninitialized function pointers with the defaults 930 931 */ 931 - if (nand_scan_tail(mtd)) { 932 - res = -ENXIO; 932 + res = nand_scan_tail(mtd); 933 + if (res) 933 934 goto err_exit3; 934 - } 935 935 936 936 mtd->name = "nxp_lpc3220_slc"; 937 937 res = mtd_device_register(mtd, host->ncfg->parts,