Commit f6ef3d9f authored by Peng Fan's avatar Peng Fan Committed by Shawn Guo
Browse files

soc: imx8m: Fix error handling for clk_prepare_enable()



imx8m_soc_prepare() directly returns the result of clk_prepare_enable(),
which skips proper cleanup if the clock enable fails. Check the return
value of clk_prepare_enable() and release resources if failure.

Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarDan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/r/202601111406.ZVV3YaiU-lkp@intel.com/


Signed-off-by: default avatarPeng Fan <peng.fan@nxp.com>
Reviewed-by: default avatarMarco Felsch <m.felsch@pengutronix.de>
Reviewed-by: default avatarDaniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
parent 4acaf8b2
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -148,7 +148,11 @@ static int imx8m_soc_prepare(struct platform_device *pdev, const char *ocotp_com
		goto err_clk;
	}

	return clk_prepare_enable(drvdata->clk);
	ret = clk_prepare_enable(drvdata->clk);
	if (ret)
		goto err_clk;

	return 0;

err_clk:
	iounmap(drvdata->ocotp_base);