Skip to content

Commit e9a164e

Browse files
tititiou36abelvesa
authored andcommitted
clk: imx: imx8: Fix an error handling path in imx8_acm_clk_probe()
If an error occurs after a successful clk_imx_acm_attach_pm_domains() call, it must be undone. Add an explicit error handling path, re-order the code and add the missing clk_imx_acm_detach_pm_domains() call. Fixes: d3a0946 ("clk: imx: imx8: add audio clock mux driver") Reviewed-by: Peng Fan <[email protected]> Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Abel Vesa <[email protected]>
1 parent 9a0108a commit e9a164e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/clk/imx/clk-imx8-acm.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,6 @@ static int imx8_acm_clk_probe(struct platform_device *pdev)
374374
0, NULL, NULL);
375375
if (IS_ERR(hws[sels[i].clkid])) {
376376
ret = PTR_ERR(hws[sels[i].clkid]);
377-
pm_runtime_disable(&pdev->dev);
378377
goto err_clk_register;
379378
}
380379
}
@@ -384,12 +383,16 @@ static int imx8_acm_clk_probe(struct platform_device *pdev)
384383
ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, clk_hw_data);
385384
if (ret < 0) {
386385
dev_err(dev, "failed to register hws for ACM\n");
387-
pm_runtime_disable(&pdev->dev);
386+
goto err_clk_register;
388387
}
389388

390-
err_clk_register:
389+
pm_runtime_put_sync(&pdev->dev);
390+
return 0;
391391

392+
err_clk_register:
392393
pm_runtime_put_sync(&pdev->dev);
394+
pm_runtime_disable(&pdev->dev);
395+
clk_imx_acm_detach_pm_domains(&pdev->dev, &priv->dev_pm);
393396

394397
return ret;
395398
}

0 commit comments

Comments
 (0)