diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2020-05-19 16:00:09 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-06-25 16:42:01 +0300 |
commit | 17dcc86c57f019b5eb03941c66113a304eb48760 (patch) | |
tree | 2883da1fca25e04b66e5bd1b082f0a046a473d5e | |
parent | 155b83bf8ce45c0a2229e0abc92358dc3bd03974 (diff) | |
download | linux-17dcc86c57f019b5eb03941c66113a304eb48760.tar.xz |
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/oxnas_nand.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/mtd/nand/oxnas_nand.c b/drivers/mtd/nand/oxnas_nand.c index 7f0ba28f8a00..350d4226b436 100644 --- a/drivers/mtd/nand/oxnas_nand.c +++ b/drivers/mtd/nand/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: |