Commit 154298e2 authored by Miquel Raynal's avatar Miquel Raynal

mtd: rawnand: oxnas: Fix the probe error path

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: 66859249 ("mtd: nand: Add OX820 NAND Support")
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-37-miquel.raynal@bootlin.com
parent 383fc3f6
...@@ -140,10 +140,8 @@ static int oxnas_nand_probe(struct platform_device *pdev) ...@@ -140,10 +140,8 @@ static int oxnas_nand_probe(struct platform_device *pdev)
goto err_release_child; goto err_release_child;
err = mtd_device_register(mtd, NULL, 0); err = mtd_device_register(mtd, NULL, 0);
if (err) { if (err)
nand_release(chip); goto err_cleanup_nand;
goto err_release_child;
}
oxnas->chips[oxnas->nchips] = chip; oxnas->chips[oxnas->nchips] = chip;
++oxnas->nchips; ++oxnas->nchips;
...@@ -159,6 +157,8 @@ static int oxnas_nand_probe(struct platform_device *pdev) ...@@ -159,6 +157,8 @@ static int oxnas_nand_probe(struct platform_device *pdev)
return 0; return 0;
err_cleanup_nand:
nand_cleanup(chip);
err_release_child: err_release_child:
of_node_put(nand_np); of_node_put(nand_np);
err_clk_unprepare: err_clk_unprepare:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment