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 --- drivers/mtd/nand/raw/oxnas_nand.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/raw/oxnas_nand.c b/drivers/mtd/nand/raw/oxnas_nand.c index bead5ac70160..4fadfa118582 100644 --- a/drivers/mtd/nand/raw/oxnas_nand.c +++ b/drivers/mtd/nand/raw/oxnas_nand.c @@ -140,10 +140,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[oxnas->nchips] = chip; ++oxnas->nchips; @@ -159,6 +157,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:
Hi
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag fixing commit: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources").
The bot has tested the following trees: v5.6.13, v5.4.41, v4.19.123, v4.14.180, v4.9.223.
v5.6.13: Build OK! v5.4.41: Build OK! v4.19.123: Failed to apply! Possible dependencies: 00ad378f304a ("mtd: rawnand: Pass a nand_chip object to nand_scan()") 107d985a1a94 ("mtd: rawnand: diskonchip: Fix the probe error path") 59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
v4.14.180: Failed to apply! Possible dependencies: 00ad378f304a ("mtd: rawnand: Pass a nand_chip object to nand_scan()") 02f26ecf8c77 ("mtd: nand: add reworked Marvell NAND controller driver") 107d985a1a94 ("mtd: rawnand: diskonchip: Fix the probe error path") 1c782b9a8517 ("mtd: nand: mtk: change the compile sequence of mtk_nand.o and mtk_ecc.o") 263c68afb521 ("mtd: nand: pxa3xx_nand: Update Kconfig information") 34832dc44d44 ("mtd: nand: gpmi-nand: Remove wrong Kconfig help text") 577e010c24bc ("mtd: rawnand: atmel: convert driver to nand_scan()") 7928225ffcb3 ("mtd: rawnand: atmel: clarify NAND addition/removal paths") 7cce5d835467 ("MAINTAINERS: mtd/nand: update Microchip nand entry") 7da45139d264 ("mtd: rawnand: better name for the controller structure") 93db446a424c ("mtd: nand: move raw NAND related code to the raw/ subdir") b4525db6f0c6 ("MAINTAINERS: Add entry for Marvell NAND controller driver") d7d9f8ec77fe ("mtd: rawnand: add NVIDIA Tegra NAND Flash controller driver")
v4.9.223: Failed to apply! Possible dependencies: 00ad378f304a ("mtd: rawnand: Pass a nand_chip object to nand_scan()") 107d985a1a94 ("mtd: rawnand: diskonchip: Fix the probe error path") 24755a55b01f ("Documentation/00-index: update for new core-api folder") 4ad4b21b1b81 ("docs-rst: convert usb docbooks to ReST") 609f212f6a12 ("docs-rst: convert mtdnand book to ReST") 66115335fbb4 ("docs: Fix build failure") 7ddedebb03b7 ("ALSA: doc: ReSTize writing-an-alsa-driver document") 8551914a5e19 ("ALSA: doc: ReSTize alsa-driver-api document") 90f9f118b75c ("docs-rst: convert filesystems book to ReST") 93dc3a112bf8 ("doc: Convert the debugobjects DocBook template to sphinx") c441a4781ff1 ("crypto: doc - remove crypto API DocBook") d6ba7a9c8b5a ("doc: Sphinxify the tracepoint docbook") e7f08ffb1855 ("Documentation/workqueue.txt: convert to ReST markup") f3fc83e55533 ("docs: Fix htmldocs build failure")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
On Tue, 2020-05-19 at 13:00:09 UTC, Miquel Raynal wrote:
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
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next.
Miquel
linux-stable-mirror@lists.linaro.org