* [PATCH] crypto: atmel - use list_first_entry_or_null to simplify find_dev
@ 2026-03-08 23:22 Thorsten Blum
2026-03-14 5:19 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-03-08 23:22 UTC (permalink / raw)
To: Herbert Xu, David S. Miller, Nicolas Ferre, Alexandre Belloni,
Claudiu Beznea
Cc: Thorsten Blum, linux-crypto, linux-arm-kernel, linux-kernel
Use list_first_entry_or_null() to simplify atmel_sha_find_dev() and
remove the now-unused local variable 'struct atmel_sha_dev *tmp'.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/crypto/atmel-sha.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
index 1f1341a16c42..002b62902553 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -404,20 +404,13 @@ static void atmel_sha_fill_padding(struct atmel_sha_reqctx *ctx, int length)
static struct atmel_sha_dev *atmel_sha_find_dev(struct atmel_sha_ctx *tctx)
{
- struct atmel_sha_dev *dd = NULL;
- struct atmel_sha_dev *tmp;
+ struct atmel_sha_dev *dd;
spin_lock_bh(&atmel_sha.lock);
- if (!tctx->dd) {
- list_for_each_entry(tmp, &atmel_sha.dev_list, list) {
- dd = tmp;
- break;
- }
- tctx->dd = dd;
- } else {
- dd = tctx->dd;
- }
-
+ if (!tctx->dd)
+ tctx->dd = list_first_entry_or_null(&atmel_sha.dev_list,
+ struct atmel_sha_dev, list);
+ dd = tctx->dd;
spin_unlock_bh(&atmel_sha.lock);
return dd;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: atmel - use list_first_entry_or_null to simplify find_dev
2026-03-08 23:22 [PATCH] crypto: atmel - use list_first_entry_or_null to simplify find_dev Thorsten Blum
@ 2026-03-14 5:19 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2026-03-14 5:19 UTC (permalink / raw)
To: Thorsten Blum
Cc: David S. Miller, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
linux-crypto, linux-arm-kernel, linux-kernel
On Mon, Mar 09, 2026 at 12:22:32AM +0100, Thorsten Blum wrote:
> Use list_first_entry_or_null() to simplify atmel_sha_find_dev() and
> remove the now-unused local variable 'struct atmel_sha_dev *tmp'.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> drivers/crypto/atmel-sha.c | 17 +++++------------
> 1 file changed, 5 insertions(+), 12 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-14 5:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-08 23:22 [PATCH] crypto: atmel - use list_first_entry_or_null to simplify find_dev Thorsten Blum
2026-03-14 5:19 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox