]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
crypto: artpec6 - refactor crypto_setup_out_descr for readability
authorThorsten Blum <thorsten.blum@linux.dev>
Wed, 6 May 2026 09:16:28 +0000 (11:16 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 15 May 2026 10:08:47 +0000 (18:08 +0800)
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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/axis/artpec6_crypto.c

index a4793b76300cffd1b786ebd19d2c7873ed82c11d..2bf8d71c86f422e4ff01f7a3d8bc5aabce012f43 100644 (file)
@@ -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