[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090423132358.2adf4611.akpm@linux-foundation.org>
Date: Thu, 23 Apr 2009 13:23:58 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: "H Hartley Sweeten" <hartleys@...ionengravers.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/vmalloc.c: fix sparse warning
On Fri, 17 Apr 2009 20:55:06 -0400
"H Hartley Sweeten" <hartleys@...ionengravers.com> wrote:
> Fix sparse warning in mm/vmalloc.c.
>
> warning: symbol 'tmp' shadows an earlier one
>
> Signed-off-by: H Hartley Sweeten <hsweeten@...ionengravers.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".
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists