crypto: atmel - use list_first_entry_or_null to simplify find_dev
Subsystems (2)
PATCH 1/1 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 <[email protected]>
--- drivers/crypto/atmel-sha.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
drivers/crypto/atmel-sha.c +5 -12
@@ -404,20 +404,13 @@ static void atmel_sha_fill_padding(struct atmel_sha_reqctx *ctx, int length)static struct atmel_sha_dev *atmel_sha_find_dev (struct atmel_sha_ctx *tctx) { -struct atmel_sha_dev *dd =NULL ; -struct atmel_sha_dev *tmp; +struct atmel_sha_dev *dd;spin_lock_bh (&atmel_sha.lock); -if (!tctx->dd) { -list_for_each_entry (tmp, &atmel_sha.dev_list, list) { - dd = tmp; -break ; - } - tctx->dd = dd; - }else { - dd = tctx->dd; - } - +if (!tctx->dd) + tctx->dd =list_first_entry_or_null (&atmel_sha.dev_list, + struct atmel_sha_dev, list); + dd = tctx->dd;spin_unlock_bh (&atmel_sha.lock);return dd;
Herbert Xu
maintainerQuoted 7 lines · Thorsten Blum
Use
list_first_entry_or_null()to simplifyatmel_sha_find_dev()and remove the now-unused local variable 'structatmel_sha_dev*tmp'.Signed-off-by Thorsten Blum <[email protected]>--- drivers/crypto/atmel-sha.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt