Commit 876ba603 authored by Boris Brezillon's avatar Boris Brezillon Committed by Miquel Raynal

mtd: rawnand: ams-delta: Check mtd_device_register() return code

mtd_device_register() can fail, and when it does we should propagate
the error and cleanup what has been done before.
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
Tested-by: default avatarJanusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent 8bbc3c08
......@@ -283,10 +283,16 @@ static int ams_delta_init(struct platform_device *pdev)
goto err_unmap;
/* Register the partitions */
mtd_device_register(mtd, partition_info, ARRAY_SIZE(partition_info));
err = mtd_device_register(mtd, partition_info,
ARRAY_SIZE(partition_info));
if (err)
goto err_nand_cleanup;
return 0;
err_nand_cleanup:
nand_cleanup(this);
err_unmap:
iounmap(io_base);
......
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