Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: atmel - use list_first_entry_or_null to simplify find_dev

Use list_first_entry_or_null() to simplify atmel_sha_find_dev() and
remove the now-unused local variable 'struct atmel_sha_dev *tmp'.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Thorsten Blum and committed by
Herbert Xu
c708d3fa c8a9a647

+5 -12
+5 -12
drivers/crypto/atmel-sha.c
··· 404 404 405 405 static struct atmel_sha_dev *atmel_sha_find_dev(struct atmel_sha_ctx *tctx) 406 406 { 407 - struct atmel_sha_dev *dd = NULL; 408 - struct atmel_sha_dev *tmp; 407 + struct atmel_sha_dev *dd; 409 408 410 409 spin_lock_bh(&atmel_sha.lock); 411 - if (!tctx->dd) { 412 - list_for_each_entry(tmp, &atmel_sha.dev_list, list) { 413 - dd = tmp; 414 - break; 415 - } 416 - tctx->dd = dd; 417 - } else { 418 - dd = tctx->dd; 419 - } 420 - 410 + if (!tctx->dd) 411 + tctx->dd = list_first_entry_or_null(&atmel_sha.dev_list, 412 + struct atmel_sha_dev, list); 413 + dd = tctx->dd; 421 414 spin_unlock_bh(&atmel_sha.lock); 422 415 423 416 return dd;