aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2020-05-19 15:00:09 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-06-25 15:33:08 +0200
commit45ed31bed499a8a8be4b6c48f0dbc489081e5ac3 (patch)
treec0b36a75e1e147cd55b948304929bd4eddb3330d
parent09fc51a9fa5264d496ef51c66d33cd8bc305d302 (diff)
downloadlinux-yocto-45ed31bed499a8a8be4b6c48f0dbc489081e5ac3.tar.gz
linux-yocto-45ed31bed499a8a8be4b6c48f0dbc489081e5ac3.tar.bz2
linux-yocto-45ed31bed499a8a8be4b6c48f0dbc489081e5ac3.zip
mtd: rawnand: oxnas: Fix the probe error path
[ Upstream commit 154298e2a3f6c9ce1d76cdb48d89fd5b107ea1a3 ] nand_release() is supposed be called after MTD device registration. Here, only nand_scan() happened, so use nand_cleanup() instead. While at it, be consistent and move the function call in the error path thanks to a goto statement. Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support") Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-37-miquel.raynal@bootlin.com Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/mtd/nand/raw/oxnas_nand.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/mtd/nand/raw/oxnas_nand.c b/drivers/mtd/nand/raw/oxnas_nand.c
index 7509bcd96135..d3f274b2e56d 100644
--- a/drivers/mtd/nand/raw/oxnas_nand.c
+++ b/drivers/mtd/nand/raw/oxnas_nand.c
@@ -147,10 +147,8 @@ static int oxnas_nand_probe(struct platform_device *pdev)
goto err_release_child;
err = mtd_device_register(mtd, NULL, 0);
- if (err) {
- nand_release(chip);
- goto err_release_child;
- }
+ if (err)
+ goto err_cleanup_nand;
oxnas->chips[nchips] = chip;
++nchips;
@@ -166,6 +164,8 @@ static int oxnas_nand_probe(struct platform_device *pdev)
return 0;
+err_cleanup_nand:
+ nand_cleanup(chip);
err_release_child:
of_node_put(nand_np);
err_clk_unprepare: