[PATCH] crypto: rockchip: propagate activation errors

From: Pengpeng Hou

Date: Sun Aug 30 2026 - 09:08:16 EST


The Rockchip crypto driver ignores reset and crypto-engine start failures
in
probe, and ignores a reset deassertion failure during runtime resume. It
can therefore publish or resume the crypto device without a usable engine.

Return reset and engine-start failures, and disable the clocks if a runtime
resume reset deassertion fails.

Fixes: 433cd2c617bf ("crypto: rockchip - add crypto driver for rk3288")
Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
---
drivers/crypto/rockchip/rk3288_crypto.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/rockchip/rk3288_crypto.c b/drivers/crypto/rockchip/rk3288_crypto.c
index 7cb1316b6f189..18ecbec1f101b 100644
--- a/drivers/crypto/rockchip/rk3288_crypto.c
+++ b/drivers/crypto/rockchip/rk3288_crypto.c
@@ -133,7 +133,12 @@ static int rk_crypto_pm_resume(struct device *dev)
if (ret)
return ret;

- reset_control_deassert(rkdev->rst);
+ ret = reset_control_deassert(rkdev->rst);
+ if (ret) {
+ rk_crypto_disable_clk(rkdev);
+ return ret;
+ }
+
return 0;

}
@@ -341,9 +346,14 @@ static int rk_crypto_probe(struct platform_device *pdev)
goto err_crypto;
}

- reset_control_assert(crypto_info->rst);
+ err = reset_control_assert(crypto_info->rst);
+ if (err)
+ goto err_crypto;
+
usleep_range(10, 20);
- reset_control_deassert(crypto_info->rst);
+ err = reset_control_deassert(crypto_info->rst);
+ if (err)
+ goto err_crypto;

crypto_info->reg = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(crypto_info->reg)) {
@@ -374,7 +384,10 @@ static int rk_crypto_probe(struct platform_device *pdev)
goto err_crypto;
}

- crypto_engine_start(crypto_info->engine);
+ err = crypto_engine_start(crypto_info->engine);
+ if (err)
+ goto err_pm;
+
init_completion(&crypto_info->complete);

err = rk_crypto_pm_init(crypto_info);

base-commit: 08dbfad3f5040f5bdb6c529da20d6d4e81fefd72
--
2.50.1