diff options
| author | Miquel Raynal <miquel.raynal@bootlin.com> | 2018-03-21 09:01:50 -0400 |
|---|---|---|
| committer | Boris Brezillon <boris.brezillon@bootlin.com> | 2018-03-29 03:38:19 -0400 |
| commit | be051bf28f8084bd75f6fd67b2f3fb7d4883751d (patch) | |
| tree | 6afa31970c7aa2a179269959494d16a64f1bbe57 /drivers/mtd | |
| parent | 4e5d1d9078eda3de65f478b248cae882e2c0a839 (diff) | |
mtd: rawnand: mxc: fix probe function error path
An error after nand_scan_tail() should trigger a nand_cleanup().
The helper mtd_device_parse_register() returns an error code that should
be checked and nand_cleanup() called accordingly.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Diffstat (limited to 'drivers/mtd')
| -rw-r--r-- | drivers/mtd/nand/raw/mxc_nand.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c index 944ecf03d3b1..45786e707b7b 100644 --- a/drivers/mtd/nand/raw/mxc_nand.c +++ b/drivers/mtd/nand/raw/mxc_nand.c | |||
| @@ -1911,15 +1911,18 @@ static int mxcnd_probe(struct platform_device *pdev) | |||
| 1911 | goto escan; | 1911 | goto escan; |
| 1912 | 1912 | ||
| 1913 | /* Register the partitions */ | 1913 | /* Register the partitions */ |
| 1914 | mtd_device_parse_register(mtd, part_probes, | 1914 | err = mtd_device_parse_register(mtd, part_probes, NULL, |
| 1915 | NULL, | 1915 | host->pdata.parts, |
| 1916 | host->pdata.parts, | 1916 | host->pdata.nr_parts); |
| 1917 | host->pdata.nr_parts); | 1917 | if (err) |
| 1918 | goto cleanup_nand; | ||
| 1918 | 1919 | ||
| 1919 | platform_set_drvdata(pdev, host); | 1920 | platform_set_drvdata(pdev, host); |
| 1920 | 1921 | ||
| 1921 | return 0; | 1922 | return 0; |
| 1922 | 1923 | ||
| 1924 | cleanup_nand: | ||
| 1925 | nand_cleanup(this); | ||
| 1923 | escan: | 1926 | escan: |
| 1924 | if (host->clk_act) | 1927 | if (host->clk_act) |
| 1925 | clk_disable_unprepare(host->clk); | 1928 | clk_disable_unprepare(host->clk); |
