mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
crypto: starfive - use list_first_entry_or_null to simplify cryp_find_dev
Use list_first_entry_or_null() to simplify starfive_cryp_find_dev() and remove the now-unused local variable 'struct starfive_cryp_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
c3494e6fbb
commit
bee54677bc
|
|
@ -36,19 +36,14 @@ static struct starfive_dev_list dev_list = {
|
|||
|
||||
struct starfive_cryp_dev *starfive_cryp_find_dev(struct starfive_cryp_ctx *ctx)
|
||||
{
|
||||
struct starfive_cryp_dev *cryp = NULL, *tmp;
|
||||
struct starfive_cryp_dev *cryp;
|
||||
|
||||
spin_lock_bh(&dev_list.lock);
|
||||
if (!ctx->cryp) {
|
||||
list_for_each_entry(tmp, &dev_list.dev_list, list) {
|
||||
cryp = tmp;
|
||||
break;
|
||||
}
|
||||
ctx->cryp = cryp;
|
||||
} else {
|
||||
cryp = ctx->cryp;
|
||||
}
|
||||
|
||||
if (!ctx->cryp)
|
||||
ctx->cryp = list_first_entry_or_null(&dev_list.dev_list,
|
||||
struct starfive_cryp_dev,
|
||||
list);
|
||||
cryp = ctx->cryp;
|
||||
spin_unlock_bh(&dev_list.lock);
|
||||
|
||||
return cryp;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user