]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: qat - simplify adf_service_mask_to_string helper
authorThorsten Blum <thorsten.blum@linux.dev>
Wed, 27 May 2026 17:46:55 +0000 (19:46 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 5 Jun 2026 11:36:36 +0000 (19:36 +0800)
Use a single scnprintf() for each set bit and drop the offset in the
else branch to simplify adf_service_mask_to_string().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Acked-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/intel/qat/qat_common/adf_cfg_services.c

index 7d00bcb41ce70a7b47314550e0b1575210aef076..1af6da8b263fbd2f8c640b57327676abdc5f587f 100644 (file)
@@ -94,10 +94,9 @@ static int adf_service_mask_to_string(unsigned long mask, char *buf, size_t len)
        for_each_set_bit(bit, &mask, SVC_COUNT) {
                if (offset)
                        offset += scnprintf(buf + offset, len - offset,
-                                           ADF_SERVICES_DELIMITER);
-
-               offset += scnprintf(buf + offset, len - offset, "%s",
-                                   adf_cfg_services[bit]);
+                               ADF_SERVICES_DELIMITER "%s", adf_cfg_services[bit]);
+               else
+                       offset += scnprintf(buf, len, "%s", adf_cfg_services[bit]);
        }
 
        return 0;