* [PATCH] mm/vmalloc.c: fix sparse warning
@ 2009-04-18 0:55 H Hartley Sweeten
2009-04-23 20:23 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: H Hartley Sweeten @ 2009-04-18 0:55 UTC (permalink / raw)
To: linux-kernel
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();
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/vmalloc.c: fix sparse warning
2009-04-18 0:55 [PATCH] mm/vmalloc.c: fix sparse warning H Hartley Sweeten
@ 2009-04-23 20:23 ` Andrew Morton
2009-04-23 20:35 ` Al Viro
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2009-04-23 20:23 UTC (permalink / raw)
To: H Hartley Sweeten; +Cc: linux-kernel
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".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/vmalloc.c: fix sparse warning
2009-04-23 20:23 ` Andrew Morton
@ 2009-04-23 20:35 ` Al Viro
2009-04-23 20:51 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2009-04-23 20:35 UTC (permalink / raw)
To: Andrew Morton; +Cc: H Hartley Sweeten, linux-kernel
On Thu, Apr 23, 2009 at 01:23:58PM -0700, Andrew Morton wrote:
> 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
Folks, could we please add to appropriate documentation (SubmittingPatches,
perhaps) a bit about using descriptive subjects?
In general, "$TOOL warning in $FILE" says nothing useful. In this case
"Get rid of shadowed variable in mm/vmalloc.c:<function>" would be far
more useful, with "found by sparse" _maybe_ showing up in the commit
message more or less as a footnote. Or even "shadowed variable in
mm/vmalloc.c:<function>".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/vmalloc.c: fix sparse warning
2009-04-23 20:35 ` Al Viro
@ 2009-04-23 20:51 ` Andrew Morton
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2009-04-23 20:51 UTC (permalink / raw)
To: Al Viro; +Cc: hartleys, linux-kernel
On Thu, 23 Apr 2009 21:35:57 +0100
Al Viro <viro@ZenIV.linux.org.uk> wrote:
> On Thu, Apr 23, 2009 at 01:23:58PM -0700, Andrew Morton wrote:
> > 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
>
> Folks, could we please add to appropriate documentation (SubmittingPatches,
> perhaps) a bit about using descriptive subjects?
If everyone did that, my typing skillz would deteriorate.
> In general, "$TOOL warning in $FILE" says nothing useful. In this case
> "Get rid of shadowed variable in mm/vmalloc.c:<function>" would be far
> more useful, with "found by sparse" _maybe_ showing up in the commit
> message more or less as a footnote. Or even "shadowed variable in
> mm/vmalloc.c:<function>".
yup.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-04-23 20:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-18 0:55 [PATCH] mm/vmalloc.c: fix sparse warning H Hartley Sweeten
2009-04-23 20:23 ` Andrew Morton
2009-04-23 20:35 ` Al Viro
2009-04-23 20:51 ` Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.