Re: [PATCH 4/5] mm: add numa node symlink for cpu devices in sysfs

From: Alex Chiang
Date: Wed Oct 21 2009 - 15:30:15 EST


* David Rientjes <rientjes@xxxxxxxxxx>:
> On Tue, 20 Oct 2009, Alex Chiang wrote:
> > * David Rientjes <rientjes@xxxxxxxxxx>:
> > > The return values of register_cpu_under_node() and
> > > unregister_cpu_under_node() are always ignored, so it would probably be
> > > best to convert these to be void functions. That doesn't mean you can
> > > simply ignore the result of the first sysfs_create_link(), though: the
> > > second should probably be suppressed if the first returns an error.
> >
> > I didn't want to change too much in the patch. Changing the
> > function signature seems a bit overeager, but if you have strong
> > feelings, I can do so.
>
> It's entirely up to you if you want to change them to be void. I thought
> it would be cleaner if the first patch in the series would convert them to
> void on the basis that the return value is never actually used and then
> the following patches simply return on error conditions.

I made the conversion as you suggested, but discovered under
sparse that:

drivers/base/node.c: In function âregister_cpu_under_nodeâ:
drivers/base/node.c:245: warning: ignoring return value of
âsysfs_create_linkâ, declared with attribute warn_unused_result

I wasn't very happy with the result after doing something with
the return value of sysfs_create_link to make sparse shutup.
Seemed unnatural and very much had the feeling of jumping through
hoops just to make an automated tool be quiet.

So, I'll just leave [un]register_cpu_under_node() as returning
int. It not only makes the patch feel better, but if we do ever
want to decide to unroll due to an error in sysfs_create_link,
we'll have the information available at the callsites.

Thanks.
/ac

--
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/