]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
crypto: bcm - Drop unused setting of local 'ptr' variable
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Sat, 4 Jan 2025 20:55:02 +0000 (21:55 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 14 Jan 2025 03:31:13 +0000 (11:31 +0800)
spum_cipher_req_init() assigns 'spu_hdr' to local 'ptr' variable and
later increments 'ptr' over specific fields like it was meant to point
to pieces of message for some purpose.  However the code does not read
'ptr' at all thus this entire iteration over 'spu_hdr' seams pointless.

Reported by clang W=1 build:

  drivers/crypto/bcm/spu.c:839:6: error: variable 'ptr' set but not used [-Werror,-Wunused-but-set-variable]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/bcm/spu.c

index 6283e8c6d51d3ea4ffb75fd19427a44edf76a145..86c227caa722cd2ccff0c1e290be75844d04d7b7 100644 (file)
@@ -836,7 +836,6 @@ u16 spum_cipher_req_init(u8 *spu_hdr, struct spu_cipher_parms *cipher_parms)
        u32 cipher_bits = 0;
        u32 ecf_bits = 0;
        u8 sctx_words = 0;
-       u8 *ptr = spu_hdr;
 
        flow_log("%s()\n", __func__);
        flow_log("  cipher alg:%u mode:%u type %u\n", cipher_parms->alg,
@@ -847,7 +846,6 @@ u16 spum_cipher_req_init(u8 *spu_hdr, struct spu_cipher_parms *cipher_parms)
 
        /* starting out: zero the header (plus some) */
        memset(spu_hdr, 0, sizeof(struct SPUHEADER));
-       ptr += sizeof(struct SPUHEADER);
 
        /* format master header word */
        /* Do not set the next bit even though the datasheet says to */
@@ -861,10 +859,8 @@ u16 spum_cipher_req_init(u8 *spu_hdr, struct spu_cipher_parms *cipher_parms)
 
        /* copy the encryption keys in the SAD entry */
        if (cipher_parms->alg) {
-               if (cipher_parms->key_len) {
-                       ptr += cipher_parms->key_len;
+               if (cipher_parms->key_len)
                        sctx_words += cipher_parms->key_len / 4;
-               }
 
                /*
                 * if encrypting then set IV size, use SCTX IV unless no IV
@@ -873,7 +869,6 @@ u16 spum_cipher_req_init(u8 *spu_hdr, struct spu_cipher_parms *cipher_parms)
                if (cipher_parms->iv_len) {
                        /* Use SCTX IV */
                        ecf_bits |= SCTX_IV;
-                       ptr += cipher_parms->iv_len;
                        sctx_words += cipher_parms->iv_len / 4;
                }
        }