Add clk_disable_unprepare(core_clk) when enable iface_clk failed. Fixes: a7e12e7bda08 ("soc: qcom: ocmem: make iface clock optional") Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx> --- drivers/soc/qcom/ocmem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/ocmem.c b/drivers/soc/qcom/ocmem.c index 6edc18b211aa..20f5461d46b9 100644 --- a/drivers/soc/qcom/ocmem.c +++ b/drivers/soc/qcom/ocmem.c @@ -341,12 +341,14 @@ static int ocmem_dev_probe(struct platform_device *pdev) ret = clk_prepare_enable(ocmem->core_clk); if (ret) return dev_err_probe(ocmem->dev, ret, "Failed to enable core clock\n"); ret = clk_prepare_enable(ocmem->iface_clk); - if (ret) + if (ret) { + clk_disable_unprepare(ocmem->core_clk); return dev_err_probe(ocmem->dev, ret, "Failed to enable iface clock\n"); + } if (qcom_scm_restore_sec_cfg_available()) { dev_dbg(dev, "configuring scm\n"); ret = qcom_scm_restore_sec_cfg(QCOM_SCM_OCMEM_DEV_ID, 0); if (ret) { -- 2.25.1