crypto: stm32 - use list_first_entry_or_null to simplify hash_find_dev
Use list_first_entry_or_null() to simplify stm32_hash_find_dev() and remove the now-unused local variable 'struct stm32_hash_dev *tmp'. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>master
parent
d0c0a414cc
commit
1a9670df56
|
|
@ -792,19 +792,13 @@ static int stm32_hash_dma_send(struct stm32_hash_dev *hdev)
|
|||
|
||||
static struct stm32_hash_dev *stm32_hash_find_dev(struct stm32_hash_ctx *ctx)
|
||||
{
|
||||
struct stm32_hash_dev *hdev = NULL, *tmp;
|
||||
struct stm32_hash_dev *hdev;
|
||||
|
||||
spin_lock_bh(&stm32_hash.lock);
|
||||
if (!ctx->hdev) {
|
||||
list_for_each_entry(tmp, &stm32_hash.dev_list, list) {
|
||||
hdev = tmp;
|
||||
break;
|
||||
}
|
||||
ctx->hdev = hdev;
|
||||
} else {
|
||||
hdev = ctx->hdev;
|
||||
}
|
||||
|
||||
if (!ctx->hdev)
|
||||
ctx->hdev = list_first_entry_or_null(&stm32_hash.dev_list,
|
||||
struct stm32_hash_dev, list);
|
||||
hdev = ctx->hdev;
|
||||
spin_unlock_bh(&stm32_hash.lock);
|
||||
|
||||
return hdev;
|
||||
|
|
|
|||
Loading…
Reference in New Issue