Skip to content

Commit

Permalink
crypto: mcryptd - use list_first_entry_or_null()
Browse files Browse the repository at this point in the history
Simplify mcryptd_opportunistic_flush() with list_first_entry_or_null().

Signed-off-by: Geliang Tang <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
geliangtang authored and herbertx committed Nov 23, 2015
1 parent 304e481 commit 0834617
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions crypto/mcryptd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 0834617

Please sign in to comment.