Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08346170 authored by Geliang Tang's avatar Geliang Tang Committed by Herbert Xu
Browse files

crypto: mcryptd - use list_first_entry_or_null()



Simplify mcryptd_opportunistic_flush() with list_first_entry_or_null().

Signed-off-by: default avatarGeliang Tang <geliangtang@163.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 304e4818
Loading
Loading
Loading
Loading
+2 −6
Original line number Original line Diff line number Diff line
@@ -128,13 +128,9 @@ static void mcryptd_opportunistic_flush(void)
	flist = per_cpu_ptr(mcryptd_flist, smp_processor_id());
	flist = per_cpu_ptr(mcryptd_flist, smp_processor_id());
	while (single_task_running()) {
	while (single_task_running()) {
		mutex_lock(&flist->lock);
		mutex_lock(&flist->lock);
		if (list_empty(&flist->list)) {
		cstate = list_first_entry_or_null(&flist->list,
			mutex_unlock(&flist->lock);
			return;
		}
		cstate = list_entry(flist->list.next,
				struct mcryptd_alg_cstate, flush_list);
				struct mcryptd_alg_cstate, flush_list);
		if (!cstate->flusher_engaged) {
		if (!cstate || !cstate->flusher_engaged) {
			mutex_unlock(&flist->lock);
			mutex_unlock(&flist->lock);
			return;
			return;
		}
		}