Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ce93bedb authored by Fabio Estevam's avatar Fabio Estevam Committed by Boris Brezillon
Browse files

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: default avatarFabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: default avatarMarek Vasut <marex@denx.de>
Acked-by: default avatarHan Xu <han.xu@nxp.com>
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
parent 07d9a380
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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;
}