Commit 9326dc75 authored by Miquel Raynal's avatar Miquel Raynal Committed by Boris Brezillon

mtd: rawnand: hisi504: clean the probe function error path

There is not need for a goto statement when the only action to take is
to return.
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
parent 682cae27
...@@ -731,23 +731,19 @@ static int hisi_nfc_probe(struct platform_device *pdev) ...@@ -731,23 +731,19 @@ static int hisi_nfc_probe(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0) {
dev_err(dev, "no IRQ resource defined\n"); dev_err(dev, "no IRQ resource defined\n");
ret = -ENXIO; return -ENXIO;
goto err_res;
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
host->iobase = devm_ioremap_resource(dev, res); host->iobase = devm_ioremap_resource(dev, res);
if (IS_ERR(host->iobase)) { if (IS_ERR(host->iobase))
ret = PTR_ERR(host->iobase); return PTR_ERR(host->iobase);
goto err_res;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 1); res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
host->mmio = devm_ioremap_resource(dev, res); host->mmio = devm_ioremap_resource(dev, res);
if (IS_ERR(host->mmio)) { if (IS_ERR(host->mmio)) {
ret = PTR_ERR(host->mmio);
dev_err(dev, "devm_ioremap_resource[1] fail\n"); dev_err(dev, "devm_ioremap_resource[1] fail\n");
goto err_res; return PTR_ERR(host->mmio);
} }
mtd->name = "hisi_nand"; mtd->name = "hisi_nand";
...@@ -770,19 +766,17 @@ static int hisi_nfc_probe(struct platform_device *pdev) ...@@ -770,19 +766,17 @@ static int hisi_nfc_probe(struct platform_device *pdev)
ret = devm_request_irq(dev, irq, hinfc_irq_handle, 0x0, "nandc", host); ret = devm_request_irq(dev, irq, hinfc_irq_handle, 0x0, "nandc", host);
if (ret) { if (ret) {
dev_err(dev, "failed to request IRQ\n"); dev_err(dev, "failed to request IRQ\n");
goto err_res; return ret;
} }
ret = nand_scan_ident(mtd, max_chips, NULL); ret = nand_scan_ident(mtd, max_chips, NULL);
if (ret) if (ret)
goto err_res; return ret;
host->buffer = dmam_alloc_coherent(dev, mtd->writesize + mtd->oobsize, host->buffer = dmam_alloc_coherent(dev, mtd->writesize + mtd->oobsize,
&host->dma_buffer, GFP_KERNEL); &host->dma_buffer, GFP_KERNEL);
if (!host->buffer) { if (!host->buffer)
ret = -ENOMEM; return -ENOMEM;
goto err_res;
}
host->dma_oob = host->dma_buffer + mtd->writesize; host->dma_oob = host->dma_buffer + mtd->writesize;
memset(host->buffer, 0xff, mtd->writesize + mtd->oobsize); memset(host->buffer, 0xff, mtd->writesize + mtd->oobsize);
...@@ -798,8 +792,7 @@ static int hisi_nfc_probe(struct platform_device *pdev) ...@@ -798,8 +792,7 @@ static int hisi_nfc_probe(struct platform_device *pdev)
*/ */
default: default:
dev_err(dev, "NON-2KB page size nand flash\n"); dev_err(dev, "NON-2KB page size nand flash\n");
ret = -EINVAL; return -EINVAL;
goto err_res;
} }
hinfc_write(host, flag, HINFC504_CON); hinfc_write(host, flag, HINFC504_CON);
...@@ -809,21 +802,17 @@ static int hisi_nfc_probe(struct platform_device *pdev) ...@@ -809,21 +802,17 @@ static int hisi_nfc_probe(struct platform_device *pdev)
ret = nand_scan_tail(mtd); ret = nand_scan_tail(mtd);
if (ret) { if (ret) {
dev_err(dev, "nand_scan_tail failed: %d\n", ret); dev_err(dev, "nand_scan_tail failed: %d\n", ret);
goto err_res; return ret;
} }
ret = mtd_device_register(mtd, NULL, 0); ret = mtd_device_register(mtd, NULL, 0);
if (ret) { if (ret) {
dev_err(dev, "Err MTD partition=%d\n", ret); dev_err(dev, "Err MTD partition=%d\n", ret);
goto err_mtd; nand_release(mtd);
return ret;
} }
return 0; return 0;
err_mtd:
nand_release(mtd);
err_res:
return ret;
} }
static int hisi_nfc_remove(struct platform_device *pdev) static int hisi_nfc_remove(struct platform_device *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment