crypto: atmel - use list_first_entry_or_null to simplify find_dev

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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Thorsten Blum 2026-03-09 00:22:32 +01:00 committed by Herbert Xu
parent c8a9a64753
commit c708d3fad4

View File

@ -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;