From 5358248961ae23f7253d010ddfde1cfd2556ce22 Mon Sep 17 00:00:00 2001 From: Jiawen Liu <1298662399@qq.com> Date: Tue, 18 Aug 2026 17:25:44 +0400 Subject: [PATCH] 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 --- drivers/crypto/starfive/jh7110-cryp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/starfive/jh7110-cryp.c b/drivers/crypto/starfive/jh7110-cryp.c index 842f76b0f114..c3830a7c1810 100644 --- a/drivers/crypto/starfive/jh7110-cryp.c +++ b/drivers/crypto/starfive/jh7110-cryp.c @@ -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);