Skip to contentSkip to conversation

crypto:hifn_795x.c Fix warning: variable 'ctx' set but not used

PATCH Superseded Justin P. Mattock 2 participants 4 messages Jul 6, 2010 Crypto API

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto:hifn_795x.c Fix warning: variable 'ctx' set but not used

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.

---
 drivers/crypto/hifn_795x.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/crypto/hifn_795x.c +10 -0
index 16fce3a..e7aa4dc 100644
@@ -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);
Signature · 1 line
1.7.1.rc1.21.gf3bd6
#1 lore raw
Quoted 20 lines · 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.

---
drivers/crypto/hifn_795x.c | 10 ++++++++++

1 files changed, 10 insertions(+), 0 deletions(-)
drivers/crypto/hifn_795x.c +0 -0
index 16fce3a..e7aa4dc 100644

drivers/crypto/hifn_795x.c static void hifn_flush(struct hifn_device *dev) · line 2043

Quoted 8 lines
drivers/crypto/hifn_795x.c +5 -0
@@ -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,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#2 lore raw
Quoted 16 lines · Herbert Xu
Quoted 15 lines · 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.

---
drivers/crypto/hifn_795x.c | 10 ++++++++++

1 files changed, 10 insertions(+), 0 deletions(-)
Quoted 16 lines

drivers/crypto/hifn_795x.c static void hifn_flush(struct hifn_device *dev) · line 2043

Quoted 13 lines
drivers/crypto/hifn_795x.c +5 -0
index 16fce3a..e7aa4dc 100644
@@ -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)

Quoted 4 lines

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

#3 lore raw
In reply to Herbert Xu
Quoted 7 lines

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