mtd: rawnand: fsmc: fix the probe function error path

An error after nand_scan_tail() should trigger a nand_cleanup().

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
This commit is contained in:
Miquel Raynal 2018-04-21 20:00:37 +02:00 committed by Boris Brezillon
parent 43fab011e9
commit 682cae27b1

View File

@ -1123,13 +1123,15 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
mtd->name = "nand";
ret = mtd_device_register(mtd, NULL, 0);
if (ret)
goto release_dma_write_chan;
goto cleanup_nand;
platform_set_drvdata(pdev, host);
dev_info(&pdev->dev, "FSMC NAND driver registration successful\n");
return 0;
cleanup_nand:
nand_cleanup(nand);
release_dma_write_chan:
if (host->mode == USE_DMA_ACCESS)
dma_release_channel(host->write_dma_chan);