Re: [PATCH] net/sunrpc/svc.c: fix sparse warning

From: J. Bruce Fields
Date: Mon May 11 2009 - 19:06:03 EST


On Thu, Apr 16, 2009 at 03:15:17PM -0400, H Hartley Sweeten wrote:
> On Thursday, April 16, 2009 12:06 PM, J. Bruce Fields wrote:
> > On Wed, Apr 15, 2009 at 03:46:13PM -0400, H Hartley Sweeten wrote:
> >> Fix sparse warning in net/sunrpc/svc.c.
> >>
> >> warning: symbol 'node' shadows an earlier one
> >
> > What's the other symbol?
>
> Sorry. Left that out...
>
> include/linux/nodemask.h
>
> #define any_online_node(mask) \
> ({ \
> int node; \
> for_each_node_mask(node, (mask)) \
> if (node_online(node)) \
> break; \
> node; \
> })
>
> arch/powerpc/mm/numa.c is the only other user of that macro. In that
> file the local variable is called nid, hence the name change in this
> patch.

Stupid question (and sorry for the delay): any reason that macro
couldn't just be a static inline function?

I'm sort of resistant to the idea that the caller should have to care
what local variable names the implementation uses.

--b.

>
> Regards,
> Hartley
>
> >>
> >> Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
> >>
> >> ---
> >>
> >> diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
> >> index 8847add..e781135 100644
> >> --- a/net/sunrpc/svc.c
> >> +++ b/net/sunrpc/svc.c
> >> @@ -122,7 +122,7 @@ module_param_call(pool_mode, param_set_pool_mode,
> >> param_get_pool_mode,
> >> static int
> >> svc_pool_map_choose_mode(void)
> >> {
> >> - unsigned int node;
> >> + unsigned int nid;
> >>
> >> if (num_online_nodes() > 1) {
> >> /*
> >> @@ -132,8 +132,8 @@ svc_pool_map_choose_mode(void)
> >> return SVC_POOL_PERNODE;
> >> }
> >>
> >> - node = any_online_node(node_online_map);
> >> - if (nr_cpus_node(node) > 2) {
> >> + nid = any_online_node(node_online_map);
> >> + if (nr_cpus_node(nid) > 2) {
> >> /*
> >> * Non-trivial SMP, or CONFIG_NUMA on
> >> * non-NUMA hardware, e.g. with a generic
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/