All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: artpec6 - refactor crypto_setup_out_descr for readability
@ 2026-05-06  9:16 Thorsten Blum
  2026-05-15 10:21 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-05-06  9:16 UTC (permalink / raw)
  To: Jesper Nilsson, Lars Persson, Herbert Xu, David S. Miller
  Cc: Thorsten Blum, linux-arm-kernel, linux-crypto, linux-kernel

Replace if-else with an early return to reduce code nesting, and move
the variable declarations to the top of the function.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 drivers/crypto/axis/artpec6_crypto.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/crypto/axis/artpec6_crypto.c b/drivers/crypto/axis/artpec6_crypto.c
index b04d6379244a..75e1eac15138 100644
--- a/drivers/crypto/axis/artpec6_crypto.c
+++ b/drivers/crypto/axis/artpec6_crypto.c
@@ -706,22 +706,19 @@ artpec6_crypto_setup_out_descr(struct artpec6_crypto_req_common *common,
 			       void *dst, unsigned int len, bool eop,
 			       bool use_short)
 {
-	if (use_short && len < 7) {
+	dma_addr_t dma_addr;
+	int ret;
+
+	if (use_short && len < 7)
 		return artpec6_crypto_setup_out_descr_short(common, dst, len,
 							    eop);
-	} else {
-		int ret;
-		dma_addr_t dma_addr;
 
-		ret = artpec6_crypto_dma_map_single(common, dst, len,
-						   DMA_TO_DEVICE,
-						   &dma_addr);
-		if (ret)
-			return ret;
+	ret = artpec6_crypto_dma_map_single(common, dst, len, DMA_TO_DEVICE,
+					    &dma_addr);
+	if (ret)
+		return ret;
 
-		return artpec6_crypto_setup_out_descr_phys(common, dma_addr,
-							   len, eop);
-	}
+	return artpec6_crypto_setup_out_descr_phys(common, dma_addr, len, eop);
 }
 
 /** artpec6_crypto_setup_in_descr_phys - Setup an in channel with a

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: artpec6 - refactor crypto_setup_out_descr for readability
  2026-05-06  9:16 [PATCH] crypto: artpec6 - refactor crypto_setup_out_descr for readability Thorsten Blum
@ 2026-05-15 10:21 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2026-05-15 10:21 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Jesper Nilsson, Lars Persson, David S. Miller, linux-arm-kernel,
	linux-crypto, linux-kernel

On Wed, May 06, 2026 at 11:16:28AM +0200, Thorsten Blum wrote:
> Replace if-else with an early return to reduce code nesting, and move
> the variable declarations to the top of the function.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  drivers/crypto/axis/artpec6_crypto.c | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-15 10:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-06  9:16 [PATCH] crypto: artpec6 - refactor crypto_setup_out_descr for readability Thorsten Blum
2026-05-15 10:21 ` Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.