mtd: nand: gpmi: disable the clocks on errors
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Fri Oct 28 19:59:01 PDT 2016
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=ce93bedb5ed2b16c08c6df4c797865f9ead600a3
Commit: ce93bedb5ed2b16c08c6df4c797865f9ead600a3
Parent: 07d9a380680d1c0eb51ef87ff2eab5c994949e69
Author: Fabio Estevam <fabio.estevam at nxp.com>
AuthorDate: Sat Oct 22 14:15:22 2016 -0200
Committer: Boris Brezillon <boris.brezillon at free-electrons.com>
CommitDate: Fri Oct 28 09:58:05 2016 +0200
mtd: nand: gpmi: disable the clocks on errors
We should disable the previously enabled GPMI clocks in the error paths.
Also, when gpmi_enable_clk() fails simply return the error
code immediately rather than jumping to to the 'err_out' label.
Signed-off-by: Fabio Estevam <fabio.estevam at nxp.com>
Reviewed-by: Marek Vasut <marex at denx.de>
Acked-by: Han Xu <han.xu at nxp.com>
Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
---
drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
index 0f68a99..141bd70 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
@@ -161,7 +161,7 @@ int gpmi_init(struct gpmi_nand_data *this)
ret = gpmi_enable_clk(this);
if (ret)
- goto err_out;
+ return ret;
ret = gpmi_reset_block(r->gpmi_regs, false);
if (ret)
goto err_out;
@@ -197,6 +197,7 @@ int gpmi_init(struct gpmi_nand_data *this)
gpmi_disable_clk(this);
return 0;
err_out:
+ gpmi_disable_clk(this);
return ret;
}
@@ -270,7 +271,7 @@ int bch_set_geometry(struct gpmi_nand_data *this)
ret = gpmi_enable_clk(this);
if (ret)
- goto err_out;
+ return ret;
/*
* Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this
@@ -308,6 +309,7 @@ int bch_set_geometry(struct gpmi_nand_data *this)
gpmi_disable_clk(this);
return 0;
err_out:
+ gpmi_disable_clk(this);
return ret;
}
More information about the linux-mtd-cvs
mailing list