projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
154298e
)
mtd: rawnand: oxnas: Unregister all devices on error
author
Miquel Raynal
<miquel.raynal@bootlin.com>
Tue, 19 May 2020 13:00:10 +0000
(15:00 +0200)
committer
Miquel Raynal
<miquel.raynal@bootlin.com>
Sun, 31 May 2020 08:53:35 +0000
(10:53 +0200)
On error, the oxnas probe path just frees the device which failed and
aborts the probe, leaving unreleased resources.
Fix this situation by calling mtd_device_unregister()/nand_cleanup()
on these.
Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link:
https://lore.kernel.org/linux-mtd/20200519130035.1883-38-miquel.raynal@bootlin.com
drivers/mtd/nand/raw/oxnas_nand.c
patch
|
blob
|
history
diff --git
a/drivers/mtd/nand/raw/oxnas_nand.c
b/drivers/mtd/nand/raw/oxnas_nand.c
index 4fadfa118582e826a02e0b89f335b19970a6da1e..25862d62f9948705f16cd4111bf73fdb321b0ed1 100644
(file)
--- a/
drivers/mtd/nand/raw/oxnas_nand.c
+++ b/
drivers/mtd/nand/raw/oxnas_nand.c
@@
-82,6
+82,7
@@
static int oxnas_nand_probe(struct platform_device *pdev)
struct resource *res;
int count = 0;
int err = 0;
+ int i;
/* Allocate memory for the device structure (and zero it) */
oxnas = devm_kzalloc(&pdev->dev, sizeof(*oxnas),
@@
-161,6
+162,13
@@
err_cleanup_nand:
nand_cleanup(chip);
err_release_child:
of_node_put(nand_np);
+
+ for (i = 0; i < oxnas->nchips; i++) {
+ chip = oxnas->chips[i];
+ WARN_ON(mtd_device_unregister(nand_to_mtd(chip)));
+ nand_cleanup(chip);
+ }
+
err_clk_unprepare:
clk_disable_unprepare(oxnas->clk);
return err;