mtd_device_register() can fail, and when it does we should propagate
the error and cleanup what has been done before.
Signed-off-by: Boris Brezillon <[email protected]>
Tested-by: Janusz Krzysztofik <[email protected]>
Signed-off-by: Miquel Raynal <[email protected]>
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);