linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]crypto:hifn_795x.c Fix warning: variable 'ctx' set but not used
@ 2010-07-06  6:26 Justin P. Mattock
  2010-07-06  7:03 ` Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Justin P. Mattock @ 2010-07-06  6:26 UTC (permalink / raw)
  To: linux-crypto; +Cc: davem, jkosina, linux-kernel, Justin P. Mattock

The below fixes a warning message generated by GCC
  CC [M]  drivers/crypto/hifn_795x.o
drivers/crypto/hifn_795x.c: In function 'hifn_flush':
drivers/crypto/hifn_795x.c:2021:23: warning: variable 'ctx' set but not used
drivers/crypto/hifn_795x.c: In function 'hifn_process_queue':
drivers/crypto/hifn_795x.c:2142:23: warning: variable 'ctx' set but not used

Please have a look, and let me know if this is legit or not.

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>

---
 drivers/crypto/hifn_795x.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
index 16fce3a..e7aa4dc 100644
--- a/drivers/crypto/hifn_795x.c
+++ b/drivers/crypto/hifn_795x.c
@@ -2036,6 +2036,11 @@ static void hifn_flush(struct hifn_device *dev)
 	spin_lock_irqsave(&dev->lock, flags);
 	while ((async_req = crypto_dequeue_request(&dev->queue))) {
 		ctx = crypto_tfm_ctx(async_req->tfm);
+			if (ctx) {
+				dprintk("%s: Flushing shash. %s\n", 
+				dev->name, ctx);
+				return;
+			} 
 		req = container_of(async_req, struct ablkcipher_request, base);
 		spin_unlock_irqrestore(&dev->lock, flags);
 
@@ -2157,6 +2162,11 @@ static int hifn_process_queue(struct hifn_device *dev)
 			backlog->complete(backlog, -EINPROGRESS);
 
 		ctx = crypto_tfm_ctx(async_req->tfm);
+			if (ctx) {
+				dprintk("%s: shash in queue. %s\n",
+				dev->name, ctx);
+				return 0;
+			} 
 		req = container_of(async_req, struct ablkcipher_request, base);
 
 		err = hifn_handle_req(req);
-- 
1.7.1.rc1.21.gf3bd6

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

* Re: [PATCH]crypto:hifn_795x.c Fix warning: variable 'ctx' set but not used
  2010-07-06  6:26 [PATCH]crypto:hifn_795x.c Fix warning: variable 'ctx' set but not used Justin P. Mattock
@ 2010-07-06  7:03 ` Herbert Xu
  2010-07-06 13:46   ` Justin P. Mattock
  2010-07-06 17:19   ` Justin P. Mattock
  0 siblings, 2 replies; 4+ messages in thread
From: Herbert Xu @ 2010-07-06  7:03 UTC (permalink / raw)
  To: Justin P. Mattock
  Cc: linux-crypto, davem, jkosina, linux-kernel, justinmattock

Justin P. Mattock <justinmattock@gmail.com> wrote:
> The below fixes a warning message generated by GCC
>  CC [M]  drivers/crypto/hifn_795x.o
> drivers/crypto/hifn_795x.c: In function 'hifn_flush':
> drivers/crypto/hifn_795x.c:2021:23: warning: variable 'ctx' set but not used
> drivers/crypto/hifn_795x.c: In function 'hifn_process_queue':
> drivers/crypto/hifn_795x.c:2142:23: warning: variable 'ctx' set but not used
> 
> Please have a look, and let me know if this is legit or not.
> 
> Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
> 
> ---
> drivers/crypto/hifn_795x.c |   10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
> index 16fce3a..e7aa4dc 100644
> --- a/drivers/crypto/hifn_795x.c
> +++ b/drivers/crypto/hifn_795x.c
> @@ -2036,6 +2036,11 @@ static void hifn_flush(struct hifn_device *dev)
>        spin_lock_irqsave(&dev->lock, flags);
>        while ((async_req = crypto_dequeue_request(&dev->queue))) {
>                ctx = crypto_tfm_ctx(async_req->tfm);
> +                       if (ctx) {
> +                               dprintk("%s: Flushing shash. %s\n", 
> +                               dev->name, ctx);
> +                               return;
> +                       } 

This certainly does not look right! Returning with IRQs disabled
is considered to be rude.

I believe the right answer is to delete the line initialising ctx.

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] 4+ messages in thread

* Re: [PATCH]crypto:hifn_795x.c Fix warning: variable 'ctx' set but not used
  2010-07-06  7:03 ` Herbert Xu
@ 2010-07-06 13:46   ` Justin P. Mattock
  2010-07-06 17:19   ` Justin P. Mattock
  1 sibling, 0 replies; 4+ messages in thread
From: Justin P. Mattock @ 2010-07-06 13:46 UTC (permalink / raw)
  To: Herbert Xu; +Cc: linux-crypto, davem, jkosina, linux-kernel

On 07/06/2010 12:03 AM, Herbert Xu wrote:
> Justin P. Mattock<justinmattock@gmail.com>  wrote:
>> The below fixes a warning message generated by GCC
>>   CC [M]  drivers/crypto/hifn_795x.o
>> drivers/crypto/hifn_795x.c: In function 'hifn_flush':
>> drivers/crypto/hifn_795x.c:2021:23: warning: variable 'ctx' set but not used
>> drivers/crypto/hifn_795x.c: In function 'hifn_process_queue':
>> drivers/crypto/hifn_795x.c:2142:23: warning: variable 'ctx' set but not used
>>
>> Please have a look, and let me know if this is legit or not.
>>
>> Signed-off-by: Justin P. Mattock<justinmattock@gmail.com>
>>
>> ---
>> drivers/crypto/hifn_795x.c |   10 ++++++++++
>> 1 files changed, 10 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
>> index 16fce3a..e7aa4dc 100644
>> --- a/drivers/crypto/hifn_795x.c
>> +++ b/drivers/crypto/hifn_795x.c
>> @@ -2036,6 +2036,11 @@ static void hifn_flush(struct hifn_device *dev)
>>         spin_lock_irqsave(&dev->lock, flags);
>>         while ((async_req = crypto_dequeue_request(&dev->queue))) {
>>                 ctx = crypto_tfm_ctx(async_req->tfm);
>> +                       if (ctx) {
>> +                               dprintk("%s: Flushing shash. %s\n",
>> +                               dev->name, ctx);
>> +                               return;
>> +                       }
>
> This certainly does not look right! Returning with IRQs disabled
> is considered to be rude.

Well, I certainly did not want to be rude..(searching for the right 
return etc.. when a function returns null gives not vary much results)

>
> I believe the right answer is to delete the line initialising ctx.
>
> Thanks,


o.k. then I'll resend with delete the line initialising ctx

Thanks for having a look..

Justin P. Mattock

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

* Re: [PATCH]crypto:hifn_795x.c Fix warning: variable 'ctx' set but not used
  2010-07-06  7:03 ` Herbert Xu
  2010-07-06 13:46   ` Justin P. Mattock
@ 2010-07-06 17:19   ` Justin P. Mattock
  1 sibling, 0 replies; 4+ messages in thread
From: Justin P. Mattock @ 2010-07-06 17:19 UTC (permalink / raw)
  To: Herbert Xu; +Cc: linux-crypto, davem, jkosina, linux-kernel


> This certainly does not look right! Returning with IRQs disabled
> is considered to be rude.
>
> I believe the right answer is to delete the line initialising ctx.
>
> Thanks,

o.k. hopefully this is correct this time, resent with the following 
change. let me know if it's legit or not..

Justin P. Mattock

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

end of thread, other threads:[~2010-07-06 17:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-06  6:26 [PATCH]crypto:hifn_795x.c Fix warning: variable 'ctx' set but not used Justin P. Mattock
2010-07-06  7:03 ` Herbert Xu
2010-07-06 13:46   ` Justin P. Mattock
2010-07-06 17:19   ` Justin P. Mattock

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).