diff mbox series

[-next] crypto: ccree - remove set but not used variable 'du_size'

Message ID 20190426151821.36944-1-yuehaibing@huawei.com (mailing list archive)
State Superseded
Delegated to: Herbert Xu
Headers show
Series [-next] crypto: ccree - remove set but not used variable 'du_size' | expand

Commit Message

Yue Haibing April 26, 2019, 3:18 p.m. UTC
From: YueHaibing <yuehaibing@huawei.com>

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/crypto/ccree/cc_cipher.c: In function cc_setup_key_desc:
drivers/crypto/ccree/cc_cipher.c:645:15: warning: variable du_size set but not used [-Wunused-but-set-variable]

It is never used since introduction in
commit dd8486c75085 ("crypto: ccree - move key load desc. before flow desc.")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/crypto/ccree/cc_cipher.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Gilad Ben-Yossef April 28, 2019, 7:58 a.m. UTC | #1
On Fri, Apr 26, 2019 at 7:38 PM Yue Haibing <yuehaibing@huawei.com> wrote:
>
> From: YueHaibing <yuehaibing@huawei.com>
>
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/crypto/ccree/cc_cipher.c: In function cc_setup_key_desc:
> drivers/crypto/ccree/cc_cipher.c:645:15: warning: variable du_size set but not used [-Wunused-but-set-variable]
>
> It is never used since introduction in
> commit dd8486c75085 ("crypto: ccree - move key load desc. before flow desc.")
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/crypto/ccree/cc_cipher.c | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c
> index d9f8cd5..6bd3791 100644
> --- a/drivers/crypto/ccree/cc_cipher.c
> +++ b/drivers/crypto/ccree/cc_cipher.c
> @@ -642,16 +642,12 @@ static void cc_setup_key_desc(struct crypto_tfm *tfm,
>         int direction = req_ctx->gen_ctx.op_type;
>         dma_addr_t key_dma_addr = ctx_p->user.key_dma_addr;
>         unsigned int key_len = ctx_p->keylen;
> -       unsigned int du_size = nbytes;
>         unsigned int din_size;
>
>         struct cc_crypto_alg *cc_alg =
>                 container_of(tfm->__crt_alg, struct cc_crypto_alg,
>                              skcipher_alg.base);
>
> -       if (cc_alg->data_unit)
> -               du_size = cc_alg->data_unit;

Thanks!
This is a good catch. It seems we can also drop the whole cc_alg var
as well in this case,
since it is only used by the code setting du_size....

Do you want to send a patch doing both or shall I ?

Cheers,
Gilad
Yue Haibing April 28, 2019, 8:16 a.m. UTC | #2
On 2019/4/28 15:58, Gilad Ben-Yossef wrote:
> On Fri, Apr 26, 2019 at 7:38 PM Yue Haibing <yuehaibing@huawei.com> wrote:
>>
>> From: YueHaibing <yuehaibing@huawei.com>
>>
>> Fixes gcc '-Wunused-but-set-variable' warning:
>>
>> drivers/crypto/ccree/cc_cipher.c: In function cc_setup_key_desc:
>> drivers/crypto/ccree/cc_cipher.c:645:15: warning: variable du_size set but not used [-Wunused-but-set-variable]
>>
>> It is never used since introduction in
>> commit dd8486c75085 ("crypto: ccree - move key load desc. before flow desc.")
>>
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> ---
>>  drivers/crypto/ccree/cc_cipher.c | 4 ----
>>  1 file changed, 4 deletions(-)
>>
>> diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c
>> index d9f8cd5..6bd3791 100644
>> --- a/drivers/crypto/ccree/cc_cipher.c
>> +++ b/drivers/crypto/ccree/cc_cipher.c
>> @@ -642,16 +642,12 @@ static void cc_setup_key_desc(struct crypto_tfm *tfm,
>>         int direction = req_ctx->gen_ctx.op_type;
>>         dma_addr_t key_dma_addr = ctx_p->user.key_dma_addr;
>>         unsigned int key_len = ctx_p->keylen;
>> -       unsigned int du_size = nbytes;
>>         unsigned int din_size;
>>
>>         struct cc_crypto_alg *cc_alg =
>>                 container_of(tfm->__crt_alg, struct cc_crypto_alg,
>>                              skcipher_alg.base);
>>
>> -       if (cc_alg->data_unit)
>> -               du_size = cc_alg->data_unit;
> 
> Thanks!
> This is a good catch. It seems we can also drop the whole cc_alg var
> as well in this case,
> since it is only used by the code setting du_size....
> 
> Do you want to send a patch doing both or shall I ?

Yes, will send v2, thanks!
> 
> Cheers,
> Gilad
>
diff mbox series

Patch

diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c
index d9f8cd5..6bd3791 100644
--- a/drivers/crypto/ccree/cc_cipher.c
+++ b/drivers/crypto/ccree/cc_cipher.c
@@ -642,16 +642,12 @@  static void cc_setup_key_desc(struct crypto_tfm *tfm,
 	int direction = req_ctx->gen_ctx.op_type;
 	dma_addr_t key_dma_addr = ctx_p->user.key_dma_addr;
 	unsigned int key_len = ctx_p->keylen;
-	unsigned int du_size = nbytes;
 	unsigned int din_size;
 
 	struct cc_crypto_alg *cc_alg =
 		container_of(tfm->__crt_alg, struct cc_crypto_alg,
 			     skcipher_alg.base);
 
-	if (cc_alg->data_unit)
-		du_size = cc_alg->data_unit;
-
 	switch (cipher_mode) {
 	case DRV_CIPHER_CBC:
 	case DRV_CIPHER_CBC_CTS: