Skip to contentSkip to conversation

rcu: fix sparse shadowed variable warning

PATCH In review Harvey Harrison 2 participants 2 messages Aug 26, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 rcu: fix sparse shadowed variable warning

kernel/rcuclassic.c:564:18: warning: symbol 'flags' shadows an earlier one kernel/rcuclassic.c:527:16: originally declared here

---
It would be safe in this case to just remove the second declaration of flags and reuse it as it is outside the local_irq_save/restore pair. I did it this way in case there are future changes that might mix up the use of flags.

Feel free to just remove the second flags declaration if you'd rather do it that way.

 kernel/rcuclassic.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
kernel/rcuclassic.c +3 -3
index 743cf05..ed15128 100644
@@ -561,15 +561,15 @@ static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp,
 		local_irq_restore(flags);
 
 		if (rcu_batch_after(rdp->batch, rcp->pending)) {
-			unsigned long flags;
+			unsigned long flags2;
 
 			/* and start it/schedule start if it's a new batch */
-			spin_lock_irqsave(&rcp->lock, flags);
+			spin_lock_irqsave(&rcp->lock, flags2);
 			if (rcu_batch_after(rdp->batch, rcp->pending)) {
 				rcp->pending = rdp->batch;
 				rcu_start_batch(rcp);
 			}
-			spin_unlock_irqrestore(&rcp->lock, flags);
+			spin_unlock_irqrestore(&rcp->lock, flags2);
 		}
 	}
 
Signature · 1 line
1.6.0.340.g84854
Acked-by on v1 2/2
#1 lore raw
Quoted 2 lines · Harvey Harrison

kernel/rcuclassic.c:564:18: warning: symbol 'flags' shadows an earlier one kernel/rcuclassic.c:527:16: originally declared here

Quoted 38 lines

---
It would be safe in this case to just remove the second declaration of flags and reuse it as it is outside the local_irq_save/restore pair. I did it this way in case there are future changes that might mix up the use of flags.

Feel free to just remove the second flags declaration if you'd rather do it that way.

 kernel/rcuclassic.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
kernel/rcuclassic.c +3 -3
index 743cf05..ed15128 100644
@@ -561,15 +561,15 @@ static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp,
 		local_irq_restore(flags);
 
 		if (rcu_batch_after(rdp->batch, rcp->pending)) {
-			unsigned long flags;
+			unsigned long flags2;
 
 			/* and start it/schedule start if it's a new batch */
-			spin_lock_irqsave(&rcp->lock, flags);
+			spin_lock_irqsave(&rcp->lock, flags2);
 			if (rcu_batch_after(rdp->batch, rcp->pending)) {
 				rcp->pending = rdp->batch;
 				rcu_start_batch(rcp);
 			}
-			spin_unlock_irqrestore(&rcp->lock, flags);
+			spin_unlock_irqrestore(&rcp->lock, flags2);
 		}
 	}
 
Signature · 1 line
1.6.0.340.g84854