Skip to content

Commit ce93bed

Browse files
Fabio EstevamBoris Brezillon
authored andcommitted
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>
1 parent 07d9a38 commit ce93bed

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎drivers/mtd/nand/gpmi-nand/gpmi-lib.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ int gpmi_init(struct gpmi_nand_data *this)
161161

162162
ret = gpmi_enable_clk(this);
163163
if (ret)
164-
goto err_out;
164+
return ret;
165165
ret = gpmi_reset_block(r->gpmi_regs, false);
166166
if (ret)
167167
goto err_out;
@@ -197,6 +197,7 @@ int gpmi_init(struct gpmi_nand_data *this)
197197
gpmi_disable_clk(this);
198198
return 0;
199199
err_out:
200+
gpmi_disable_clk(this);
200201
return ret;
201202
}
202203

@@ -270,7 +271,7 @@ int bch_set_geometry(struct gpmi_nand_data *this)
270271

271272
ret = gpmi_enable_clk(this);
272273
if (ret)
273-
goto err_out;
274+
return ret;
274275

275276
/*
276277
* 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)
308309
gpmi_disable_clk(this);
309310
return 0;
310311
err_out:
312+
gpmi_disable_clk(this);
311313
return ret;
312314
}
313315

0 commit comments

Comments
 (0)