Re: kernel/params.c: 'err' variable "set but not used" and perhaps should be?

2015-06-05 Thread Tejun Heo
Hello, Rusty. On Fri, Jun 05, 2015 at 10:09:29AM +0930, Rusty Russell wrote: > What will a second warning which is never triggered achieve? A bit of How do you know that tho? Somebody may change something in the module code, kernfs or sysfs and break something in an unexpected way. We've alway

Re: kernel/params.c: 'err' variable "set but not used" and perhaps should be?

2015-06-04 Thread Rusty Russell
Tejun Heo writes: > On Fri, Jun 05, 2015 at 05:16:53AM +0930, Rusty Russell wrote: >> Tejun Heo writes: >> > On Thu, Jun 04, 2015 at 11:03:16AM +0930, Rusty Russell wrote: >> >> Please describe the circumstances under which this function can fail. >> > >> > Allocation failure obviously >> >> Won

Re: kernel/params.c: 'err' variable "set but not used" and perhaps should be?

2015-06-04 Thread Tejun Heo
On Fri, Jun 05, 2015 at 05:16:53AM +0930, Rusty Russell wrote: > Tejun Heo writes: > > On Thu, Jun 04, 2015 at 11:03:16AM +0930, Rusty Russell wrote: > >> Please describe the circumstances under which this function can fail. > > > > Allocation failure obviously > > Won't happen here, this is a bo

Re: kernel/params.c: 'err' variable "set but not used" and perhaps should be?

2015-06-04 Thread Rusty Russell
Tejun Heo writes: > On Thu, Jun 04, 2015 at 11:03:16AM +0930, Rusty Russell wrote: >> Please describe the circumstances under which this function can fail. > > Allocation failure obviously Won't happen here, this is a boot-time function. version_sysfs_builtin. The __init is the clue. > and viol

Re: kernel/params.c: 'err' variable "set but not used" and perhaps should be?

2015-06-03 Thread Tejun Heo
On Thu, Jun 04, 2015 at 11:03:16AM +0930, Rusty Russell wrote: > Please describe the circumstances under which this function can fail. Allocation failure obviously and violatin of certain API rules - e.g. dup names, wrong nesting, activation rule violations. Some can be warned automatically but I

Re: kernel/params.c: 'err' variable "set but not used" and perhaps should be?

2015-06-03 Thread Rusty Russell
Tejun Heo writes: >> > @@ -853,7 +853,8 @@ static void __init version_sysfs_builtin(void) >> >mk = locate_module_kobject(vattr->module_name); >> >if (mk) { >> > - err = sysfs_create_file(&mk->kobj, >> > &vattr->mattr.attr); >> > +

Re: kernel/params.c: 'err' variable "set but not used" and perhaps should be?

2015-06-03 Thread Tejun Heo
Hello, On Wed, Jun 03, 2015 at 01:41:40PM -0600, Louis Langholtz wrote: > On Jun 1, 2015, at 7:32 PM, Rusty Russell wrote: > > That's hilarious. > > > > __attribute__((warn_unused_result)) was added to gcc as a hack so people > > wouldn't forget to use the realloc return, which probably seemed s

Re: kernel/params.c: 'err' variable "set but not used" and perhaps should be?

2015-06-03 Thread Louis Langholtz
On Jun 1, 2015, at 7:32 PM, Rusty Russell wrote: > Louis Langholtz writes: >> I get a compiler warning (on compiling the linux kernel) about the 'err' >> variable being "set but not used" in the version_sysfs_builtin() function >> of kernel/params.c (at line 848). Should it be used? >> >> The '