diff options
author | Geliang Tang <geliangtang@163.com> | 2015-11-16 22:37:15 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2015-11-23 20:55:51 +0800 |
commit | 08346170d4483d58b8971fe9ff2a1318fd93d121 (patch) | |
tree | 057407923798d82b2bb2c063b2dc6813f52ce8a5 /crypto/mcryptd.c | |
parent | 304e4818d4a45e83019ea30e4cfcb3ac2a8ce09a (diff) | |
download | op-kernel-dev-08346170d4483d58b8971fe9ff2a1318fd93d121.zip op-kernel-dev-08346170d4483d58b8971fe9ff2a1318fd93d121.tar.gz |
crypto: mcryptd - use list_first_entry_or_null()
Simplify mcryptd_opportunistic_flush() with list_first_entry_or_null().
Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/mcryptd.c')
-rw-r--r-- | crypto/mcryptd.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/crypto/mcryptd.c b/crypto/mcryptd.c index fe5b495a..f78d4fc 100644 --- a/crypto/mcryptd.c +++ b/crypto/mcryptd.c @@ -128,13 +128,9 @@ static void mcryptd_opportunistic_flush(void) flist = per_cpu_ptr(mcryptd_flist, smp_processor_id()); while (single_task_running()) { mutex_lock(&flist->lock); - if (list_empty(&flist->list)) { - mutex_unlock(&flist->lock); - return; - } - cstate = list_entry(flist->list.next, + cstate = list_first_entry_or_null(&flist->list, struct mcryptd_alg_cstate, flush_list); - if (!cstate->flusher_engaged) { + if (!cstate || !cstate->flusher_engaged) { mutex_unlock(&flist->lock); return; } |