Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: rockchip: propagate activation errors
@ 2026-08-30 13:07 Pengpeng Hou
  0 siblings, 0 replies; only message in thread
From: Pengpeng Hou @ 2026-08-30 13:07 UTC (permalink / raw)
  To: Corentin Labbe
  Cc: Pengpeng Hou, Herbert Xu, David S . Miller, Heiko Stuebner,
	Philipp Zabel, linux-crypto, linux-arm-kernel, linux-rockchip,
	linux-kernel

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@iscas.ac.cn>
---
 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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-30 13:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-30 13:07 [PATCH] crypto: rockchip: propagate activation errors Pengpeng Hou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox