linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] crypto: ccree - remove set but not used variable 'du_size'
@ 2020-02-03 15:39 YueHaibing
  2020-02-13  9:22 ` Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: YueHaibing @ 2020-02-03 15:39 UTC (permalink / raw)
  To: Ofir Drang, Gilad Ben-Yossef, Herbert Xu, Sumit Semwal
  Cc: YueHaibing, linux-crypto, linux-media, dri-devel, linaro-mm-sig,
	kernel-janitors, Hulk Robot

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

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

commit 5c83e8ec4d51 ("crypto: ccree - fix FDE descriptor sequence")
involved this unused variable, so remove it.

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

diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c
index 7d6252d892d7..b5133f57bc87 100644
--- a/drivers/crypto/ccree/cc_cipher.c
+++ b/drivers/crypto/ccree/cc_cipher.c
@@ -533,14 +533,6 @@ static void cc_setup_state_desc(struct crypto_tfm *tfm,
 	int flow_mode = ctx_p->flow_mode;
 	int direction = req_ctx->gen_ctx.op_type;
 	dma_addr_t iv_dma_addr = req_ctx->gen_ctx.iv_dma_addr;
-	unsigned int du_size = nbytes;
-
-	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_ECB:




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] crypto: ccree - remove set but not used variable 'du_size'
  2020-02-03 15:39 [PATCH -next] crypto: ccree - remove set but not used variable 'du_size' YueHaibing
@ 2020-02-13  9:22 ` Herbert Xu
  0 siblings, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2020-02-13  9:22 UTC (permalink / raw)
  To: YueHaibing
  Cc: Ofir Drang, Gilad Ben-Yossef, Sumit Semwal, linux-crypto,
	linux-media, dri-devel, linaro-mm-sig, kernel-janitors,
	Hulk Robot

On Mon, Feb 03, 2020 at 03:39:21PM +0000, YueHaibing wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
> 
> drivers/crypto/ccree/cc_cipher.c: In function 'cc_setup_state_desc':
> drivers/crypto/ccree/cc_cipher.c:536:15: warning:
>  variable 'du_size' set but not used [-Wunused-but-set-variable]
> 
> commit 5c83e8ec4d51 ("crypto: ccree - fix FDE descriptor sequence")
> involved this unused variable, so remove it.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/crypto/ccree/cc_cipher.c | 8 --------
>  1 file changed, 8 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] crypto: ccree - remove set but not used variable 'du_size'
  2019-04-28  7:58 ` Gilad Ben-Yossef
@ 2019-04-28  8:16   ` YueHaibing
  0 siblings, 0 replies; 5+ messages in thread
From: YueHaibing @ 2019-04-28  8:16 UTC (permalink / raw)
  To: Gilad Ben-Yossef
  Cc: Herbert Xu, Linux kernel mailing list, Linux Crypto Mailing List,
	David Miller

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
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] crypto: ccree - remove set but not used variable 'du_size'
  2019-04-26 15:18 Yue Haibing
@ 2019-04-28  7:58 ` Gilad Ben-Yossef
  2019-04-28  8:16   ` YueHaibing
  0 siblings, 1 reply; 5+ messages in thread
From: Gilad Ben-Yossef @ 2019-04-28  7:58 UTC (permalink / raw)
  To: Yue Haibing
  Cc: Herbert Xu, Linux kernel mailing list, Linux Crypto Mailing List,
	David Miller

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

-- 
Gilad Ben-Yossef
Chief Coffee Drinker

values of β will give rise to dom!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH -next] crypto: ccree - remove set but not used variable 'du_size'
@ 2019-04-26 15:18 Yue Haibing
  2019-04-28  7:58 ` Gilad Ben-Yossef
  0 siblings, 1 reply; 5+ messages in thread
From: Yue Haibing @ 2019-04-26 15:18 UTC (permalink / raw)
  To: gilad, herbert; +Cc: linux-kernel, linux-crypto, davem, YueHaibing

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;
-
 	switch (cipher_mode) {
 	case DRV_CIPHER_CBC:
 	case DRV_CIPHER_CBC_CTS:
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-02-13  9:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-03 15:39 [PATCH -next] crypto: ccree - remove set but not used variable 'du_size' YueHaibing
2020-02-13  9:22 ` Herbert Xu
  -- strict thread matches above, loose matches on Subject: below --
2019-04-26 15:18 Yue Haibing
2019-04-28  7:58 ` Gilad Ben-Yossef
2019-04-28  8:16   ` YueHaibing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).