mirror of
https://github.com/torvalds/linux.git
synced 2026-05-12 16:18:45 +02:00
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:
parent
c8a9a64753
commit
c708d3fad4
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user