[PATCH] crypto: jh7110-cryp: handle clock enable failures
From: Jiawen Liu
Date: Tue Aug 18 2026 - 09:29:47 EST
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 <1298662399@xxxxxx>
---
diff --git a/drivers/crypto/starfive/jh7110-cryp.c b/drivers/crypto/starfive/jh7110-cryp.c
--- a/drivers/crypto/starfive/jh7110-cryp.c
+++ b/drivers/crypto/starfive/jh7110-cryp.c
@@ -120,8 +120,15 @@
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);