Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Fabio Estevam and committed by
Boris Brezillon
ce93bedb 07d9a380

+4 -2
+4 -2
drivers/mtd/nand/gpmi-nand/gpmi-lib.c
··· 161 161 162 162 ret = gpmi_enable_clk(this); 163 163 if (ret) 164 - goto err_out; 164 + return ret; 165 165 ret = gpmi_reset_block(r->gpmi_regs, false); 166 166 if (ret) 167 167 goto err_out; ··· 197 197 gpmi_disable_clk(this); 198 198 return 0; 199 199 err_out: 200 + gpmi_disable_clk(this); 200 201 return ret; 201 202 } 202 203 ··· 271 270 272 271 ret = gpmi_enable_clk(this); 273 272 if (ret) 274 - goto err_out; 273 + return ret; 275 274 276 275 /* 277 276 * Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this ··· 309 308 gpmi_disable_clk(this); 310 309 return 0; 311 310 err_out: 311 + gpmi_disable_clk(this); 312 312 return ret; 313 313 } 314 314