public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] rcu: fix sparse shadowed variable warning
@ 2008-08-26 20:00 Harvey Harrison
  2008-08-26 20:43 ` Paul E. McKenney
  0 siblings, 1 reply; 2+ messages in thread
From: Harvey Harrison @ 2008-08-26 20:00 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: Andrew Morton, LKML

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

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
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(-)

diff --git a/kernel/rcuclassic.c b/kernel/rcuclassic.c
index 743cf05..ed15128 100644
--- a/kernel/rcuclassic.c
+++ b/kernel/rcuclassic.c
@@ -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);
 		}
 	}
 
-- 
1.6.0.340.g84854


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

* Re: [PATCH 2/2] rcu: fix sparse shadowed variable warning
  2008-08-26 20:00 [PATCH 2/2] rcu: fix sparse shadowed variable warning Harvey Harrison
@ 2008-08-26 20:43 ` Paul E. McKenney
  0 siblings, 0 replies; 2+ messages in thread
From: Paul E. McKenney @ 2008-08-26 20:43 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: Andrew Morton, LKML

On Tue, Aug 26, 2008 at 01:00:44PM -0700, Harvey Harrison wrote:
> kernel/rcuclassic.c:564:18: warning: symbol 'flags' shadows an earlier one
> kernel/rcuclassic.c:527:16: originally declared here

Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> ---
> 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(-)
> 
> diff --git a/kernel/rcuclassic.c b/kernel/rcuclassic.c
> index 743cf05..ed15128 100644
> --- a/kernel/rcuclassic.c
> +++ b/kernel/rcuclassic.c
> @@ -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);
>  		}
>  	}
> 
> -- 
> 1.6.0.340.g84854
> 

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

end of thread, other threads:[~2008-08-26 20:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-26 20:00 [PATCH 2/2] rcu: fix sparse shadowed variable warning Harvey Harrison
2008-08-26 20:43 ` Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox