From: Martin Kaiser <martin@kaiser.cx>
To: Hadar Gat <hadar.gat@arm.com>,
Olivia Mackall <olivia@selenic.com>,
Herbert Xu <herbert@gondor.apana.org.au>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Martin Kaiser <martin@kaiser.cx>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] hwrng: cctrng - fix usage counter in error path
Date: Thu, 29 Oct 2026 09:15:31 +0100 [thread overview]
Message-ID: <20261029081644.1897897-1-martin@kaiser.cx> (raw)
If probe fails after the runtime pm usage counter was incremented,
we have to decrement it before we exit.
Remove the cc_trng_pm_fini call in the error path. It calls
pm_runtime_disable before runtime pm is enabled.
Fixes: a583ed310bb6 ("hwrng: cctrng - introduce Arm CryptoCell driver")
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
based on sashiko review
https://lore.kernel.org/linux-crypto/67844d9d-d4d4-4026-9549-73589afcc1ff@wanadoo.fr/T/#m1a770f5f9eeed95b48cad7545580aed4fa74e6fa
compile-tested only
drivers/char/hw_random/cctrng.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/char/hw_random/cctrng.c b/drivers/char/hw_random/cctrng.c
index 03401ee59a8e..d9492d25ecbb 100644
--- a/drivers/char/hw_random/cctrng.c
+++ b/drivers/char/hw_random/cctrng.c
@@ -533,9 +533,9 @@ static int cctrng_probe(struct platform_device *pdev)
/* registration of the hwrng device */
rc = devm_hwrng_register(dev, &drvdata->rng);
if (rc) {
- dev_err(dev, "Could not register hwrng device.\n");
- cc_trng_pm_fini(drvdata);
- return rc;
+ pm_runtime_put_noidle(dev);
+ return dev_err_probe(dev, rc,
+ "Could not register hwrng device: %d\n", rc);
}
/* trigger HW to start generate data */
--
2.43.7
next reply other threads:[~2026-10-29 8:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 8:15 Martin Kaiser [this message]
2026-10-29 19:04 ` Christophe JAILLET
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=20261029081644.1897897-1-martin@kaiser.cx \
--to=martin@kaiser.cx \
--cc=christophe.jaillet@wanadoo.fr \
--cc=hadar.gat@arm.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olivia@selenic.com \
/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
all inboxes | Powered by JetHome®