aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@nxp.com>2016-10-22 12:15:22 -0400
committerBoris Brezillon <boris.brezillon@free-electrons.com>2016-10-28 03:58:05 -0400
commitce93bedb5ed2b16c08c6df4c797865f9ead600a3 (patch)
tree045b76762fcddfe757a539ab39425e5756851e01
parent07d9a380680d1c0eb51ef87ff2eab5c994949e69 (diff)
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@nxp.com> Reviewed-by: Marek Vasut <marex@denx.de> Acked-by: Han Xu <han.xu@nxp.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
-rw-r--r--drivers/mtd/nand/gpmi-nand/gpmi-lib.c6
1 files 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 0f68a99fc4ad..141bd70a49c2 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)
161 161
162 ret = gpmi_enable_clk(this); 162 ret = gpmi_enable_clk(this);
163 if (ret) 163 if (ret)
164 goto err_out; 164 return ret;
165 ret = gpmi_reset_block(r->gpmi_regs, false); 165 ret = gpmi_reset_block(r->gpmi_regs, false);
166 if (ret) 166 if (ret)
167 goto err_out; 167 goto err_out;
@@ -197,6 +197,7 @@ int gpmi_init(struct gpmi_nand_data *this)
197 gpmi_disable_clk(this); 197 gpmi_disable_clk(this);
198 return 0; 198 return 0;
199err_out: 199err_out:
200 gpmi_disable_clk(this);
200 return ret; 201 return ret;
201} 202}
202 203
@@ -270,7 +271,7 @@ int bch_set_geometry(struct gpmi_nand_data *this)
270 271
271 ret = gpmi_enable_clk(this); 272 ret = gpmi_enable_clk(this);
272 if (ret) 273 if (ret)
273 goto err_out; 274 return ret;
274 275
275 /* 276 /*
276 * Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this 277 * 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)
308 gpmi_disable_clk(this); 309 gpmi_disable_clk(this);
309 return 0; 310 return 0;
310err_out: 311err_out:
312 gpmi_disable_clk(this);
311 return ret; 313 return ret;
312} 314}
313 315