Skip to content

Commit 1742b0a

Browse files
krzkherbertx
authored andcommitted
crypto: bcm - Drop unused setting of local 'ptr' variable
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 <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 061b27e commit 1742b0a

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

drivers/crypto/bcm/spu.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,6 @@ u16 spum_cipher_req_init(u8 *spu_hdr, struct spu_cipher_parms *cipher_parms)
836836
u32 cipher_bits = 0;
837837
u32 ecf_bits = 0;
838838
u8 sctx_words = 0;
839-
u8 *ptr = spu_hdr;
840839

841840
flow_log("%s()\n", __func__);
842841
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)
847846

848847
/* starting out: zero the header (plus some) */
849848
memset(spu_hdr, 0, sizeof(struct SPUHEADER));
850-
ptr += sizeof(struct SPUHEADER);
851849

852850
/* format master header word */
853851
/* 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)
861859

862860
/* copy the encryption keys in the SAD entry */
863861
if (cipher_parms->alg) {
864-
if (cipher_parms->key_len) {
865-
ptr += cipher_parms->key_len;
862+
if (cipher_parms->key_len)
866863
sctx_words += cipher_parms->key_len / 4;
867-
}
868864

869865
/*
870866
* 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)
873869
if (cipher_parms->iv_len) {
874870
/* Use SCTX IV */
875871
ecf_bits |= SCTX_IV;
876-
ptr += cipher_parms->iv_len;
877872
sctx_words += cipher_parms->iv_len / 4;
878873
}
879874
}

0 commit comments

Comments
 (0)