mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "H Hartley Sweeten" <hartleys@visionengravers.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/vmalloc.c: fix sparse warning
Date: Thu, 23 Apr 2009 13:23:58 -0700	[thread overview]
Message-ID: <20090423132358.2adf4611.akpm@linux-foundation.org> (raw)
In-Reply-To: <BD79186B4FD85F4B8E60E381CAEE1909015F9239@mi8nycmail19.Mi8.com>

On Fri, 17 Apr 2009 20:55:06 -0400
"H Hartley Sweeten" <hartleys@visionengravers.com> wrote:

> Fix sparse warning in mm/vmalloc.c.
> 
>   warning: symbol 'tmp' shadows an earlier one
> 
> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
> 
> ---
> 
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index fab1987..4959a30 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -292,13 +292,13 @@ static void __insert_vmap_area(struct vmap_area
> *va)
>  	struct rb_node *tmp;
>  
>  	while (*p) {
> -		struct vmap_area *tmp;
> +		struct vmap_area *tmp_va;
>  
>  		parent = *p;
> -		tmp = rb_entry(parent, struct vmap_area, rb_node);
> -		if (va->va_start < tmp->va_end)
> +		tmp_va = rb_entry(parent, struct vmap_area, rb_node);
> +		if (va->va_start < tmp_va->va_end)
>  			p = &(*p)->rb_left;
> -		else if (va->va_end > tmp->va_start)
> +		else if (va->va_end > tmp_va->va_start)
>  			p = &(*p)->rb_right;
>  		else
>  			BUG(); 

It would be sufficient to simply delete the inner definition of `tmp'.

Use of a variable called "tmp" is often bad - it's almost always a
result of plain old laziness and the code can be improved by using a
more meaningful identifier.

But in this case the code is sufficiently short and simple that I guess
we can live with "tmp".


  reply	other threads:[~2009-04-23 20:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-18  0:55 H Hartley Sweeten
2009-04-23 20:23 ` Andrew Morton [this message]
2009-04-23 20:35   ` Al Viro
2009-04-23 20:51     ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090423132358.2adf4611.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=hartleys@visionengravers.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®