Skip to content

Commit f6ef3d9

Browse files
MrVanShawn Guo
authored andcommitted
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: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <error27@gmail.com> Closes: https://lore.kernel.org/r/202601111406.ZVV3YaiU-lkp@intel.com/ Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
1 parent 4acaf8b commit f6ef3d9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/soc/imx/soc-imx8m.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,11 @@ static int imx8m_soc_prepare(struct platform_device *pdev, const char *ocotp_com
148148
goto err_clk;
149149
}
150150

151-
return clk_prepare_enable(drvdata->clk);
151+
ret = clk_prepare_enable(drvdata->clk);
152+
if (ret)
153+
goto err_clk;
154+
155+
return 0;
152156

153157
err_clk:
154158
iounmap(drvdata->ocotp_base);

0 commit comments

Comments
 (0)