crypto: starfive - handle clock enable failures

Return error from failed clock enable.

starfive_cryp_probe ignores clk_prepare_enable return for hclk/ahb, then
remove/error paths unconditionally clk_disable_unprepare both clocks.

Check consecutive clk_prepare_enable(cryp->hclk)/cryp->ahb returns in
starfive_cryp_probe.

Signed-off-by: Jiawen Liu <1298662399@qq.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Jiawen Liu 2026-08-18 17:25:44 +04:00 committed by Herbert Xu
parent 97e5869514
commit 5358248961

View File

@ -120,8 +120,15 @@ static int starfive_cryp_probe(struct platform_device *pdev)
return dev_err_probe(&pdev->dev, PTR_ERR(cryp->rst),
"Error getting hardware reset line\n");
clk_prepare_enable(cryp->hclk);
clk_prepare_enable(cryp->ahb);
ret = clk_prepare_enable(cryp->hclk);
if (ret)
return ret;
ret = clk_prepare_enable(cryp->ahb);
if (ret) {
clk_disable_unprepare(cryp->hclk);
return ret;
}
reset_control_deassert(cryp->rst);
spin_lock(&dev_list.lock);