diff options
author | Boris Brezillon <boris.brezillon@bootlin.com> | 2018-11-11 08:55:12 +0100 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2018-12-07 10:38:25 +0100 |
commit | 876ba603c9e0fa7885f89a35ed221792caea8034 (patch) | |
tree | d42f800cdd7d724555cbb3b8b1c5fdab88841fbf /drivers/mtd/nand | |
parent | 8bbc3c0850d0668ac7cf0f5b129ffae8c810247f (diff) | |
download | linux-876ba603c9e0fa7885f89a35ed221792caea8034.tar.gz linux-876ba603c9e0fa7885f89a35ed221792caea8034.tar.bz2 linux-876ba603c9e0fa7885f89a35ed221792caea8034.zip |
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: Boris Brezillon <boris.brezillon@bootlin.com>
Tested-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r-- | drivers/mtd/nand/raw/ams-delta.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/mtd/nand/raw/ams-delta.c b/drivers/mtd/nand/raw/ams-delta.c index 0fc7563fba10..c59672a92832 100644 --- a/drivers/mtd/nand/raw/ams-delta.c +++ b/drivers/mtd/nand/raw/ams-delta.c @@ -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); |