From: Pengpeng Hou <pengpeng@iscas.ac.cn>
To: Corentin Labbe <clabbe@baylibre.com>
Cc: Pengpeng Hou <pengpeng@iscas.ac.cn>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S . Miller" <davem@davemloft.net>,
Heiko Stuebner <heiko@sntech.de>,
Philipp Zabel <p.zabel@pengutronix.de>,
linux-crypto@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH] crypto: rockchip: propagate activation errors
Date: Sun, 30 Aug 2026 21:07:48 +0800 [thread overview]
Message-ID: <20260830130748.944-1-pengpeng@iscas.ac.cn> (raw)
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
reply other threads:[~2026-08-30 13:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260830130748.944-1-pengpeng@iscas.ac.cn \
--to=pengpeng@iscas.ac.cn \
--cc=clabbe@baylibre.com \
--cc=davem@davemloft.net \
--cc=heiko@sntech.de \
--cc=herbert@gondor.apana.org.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=p.zabel@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox