Use clearer error labels as Boris Brezillon suggested.
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Reviewed-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
dev_err(nfc->dev,
"Only one NAND chip supported!\n");
err = -EINVAL;
dev_err(nfc->dev,
"Only one NAND chip supported!\n");
err = -EINVAL;
}
nand_set_flash_node(chip, child);
}
nand_set_flash_node(chip, child);
if (!nand_get_flash_node(chip)) {
dev_err(nfc->dev, "NAND chip sub-node missing!\n");
err = -ENODEV;
if (!nand_get_flash_node(chip)) {
dev_err(nfc->dev, "NAND chip sub-node missing!\n");
err = -ENODEV;
}
chip->dev_ready = vf610_nfc_dev_ready;
}
chip->dev_ready = vf610_nfc_dev_ready;
err = devm_request_irq(nfc->dev, irq, vf610_nfc_irq, 0, DRV_NAME, mtd);
if (err) {
dev_err(nfc->dev, "Error requesting IRQ!\n");
err = devm_request_irq(nfc->dev, irq, vf610_nfc_irq, 0, DRV_NAME, mtd);
if (err) {
dev_err(nfc->dev, "Error requesting IRQ!\n");
}
vf610_nfc_preinit_controller(nfc);
}
vf610_nfc_preinit_controller(nfc);
/* first scan to find the device and get the page size */
err = nand_scan_ident(mtd, 1, NULL);
if (err)
/* first scan to find the device and get the page size */
err = nand_scan_ident(mtd, 1, NULL);
if (err)
vf610_nfc_init_controller(nfc);
vf610_nfc_init_controller(nfc);
if (mtd->writesize + mtd->oobsize > PAGE_2K + OOB_MAX - 8) {
dev_err(nfc->dev, "Unsupported flash page size\n");
err = -ENXIO;
if (mtd->writesize + mtd->oobsize > PAGE_2K + OOB_MAX - 8) {
dev_err(nfc->dev, "Unsupported flash page size\n");
err = -ENXIO;
}
if (chip->ecc.mode == NAND_ECC_HW) {
if (mtd->writesize != PAGE_2K && mtd->oobsize < 64) {
dev_err(nfc->dev, "Unsupported flash with hwecc\n");
err = -ENXIO;
}
if (chip->ecc.mode == NAND_ECC_HW) {
if (mtd->writesize != PAGE_2K && mtd->oobsize < 64) {
dev_err(nfc->dev, "Unsupported flash with hwecc\n");
err = -ENXIO;
}
if (chip->ecc.size != mtd->writesize) {
dev_err(nfc->dev, "Step size needs to be page size\n");
err = -ENXIO;
}
if (chip->ecc.size != mtd->writesize) {
dev_err(nfc->dev, "Step size needs to be page size\n");
err = -ENXIO;
}
/* Only 64 byte ECC layouts known */
}
/* Only 64 byte ECC layouts known */
} else {
dev_err(nfc->dev, "Unsupported ECC strength\n");
err = -ENXIO;
} else {
dev_err(nfc->dev, "Unsupported ECC strength\n");
err = -ENXIO;
}
chip->ecc.read_page = vf610_nfc_read_page;
}
chip->ecc.read_page = vf610_nfc_read_page;
/* second phase scan */
err = nand_scan_tail(mtd);
if (err)
/* second phase scan */
err = nand_scan_tail(mtd);
if (err)
platform_set_drvdata(pdev, mtd);
/* Register device in MTD */
return mtd_device_register(mtd, NULL, 0);
platform_set_drvdata(pdev, mtd);
/* Register device in MTD */
return mtd_device_register(mtd, NULL, 0);
clk_disable_unprepare(nfc->clk);
return err;
}
clk_disable_unprepare(nfc->clk);
return err;
}