lkml.org 
[lkml]   [2006]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -mm] sysfs_remove_bin_file: no return value, no check needed
On Mon, 10 Jul 2006 14:43:42 -0700 Andrew Morton wrote:

> On Mon, 10 Jul 2006 12:29:10 -0700
> "Randy.Dunlap" <rdunlap@xenotime.net> wrote:
>
> > From: Randy Dunlap <rdunlap@xenotime.net>
> >
> > > In some cases (eg, sysfs file removal) there's not a lot the caller can do
> > > apart from warn, so we should probably change those things to return void
> > > and put a diagnostic message into the callee itself.
> >
> > sysfs_remove_bin_file() cannot tell if there is an error and
> > cannot return an error, so "fix" around 40 must-check warnings.
> >
> > Convert sysfs_remove_bin_file() from int to void since it
> > cannot return an error.
> > Remove __must_check from its declaration.
> > Convert the only function that checked the return value of
> > sysfs_remove_bin_file().
> >
>
> Yes, I think that's the best way to handle this case.
>
> But it's still an error if the file isn't there, or if the removal fails
> for some other reason. It means that someone tried to remove a file which
> they didn't add, and that a subsequent attempt to add that file will fail,
> etc.
>
> So I think a better policy would be to emit a warning from within
> sysfs_remove_bin_file(), then return void. The warning should include the
> stack trace and the filename (if poss).

Hm, OK. Like I wrote, sysfs_remove_bin_file() cannot tell if there
was an error. I can convert sysfs_hash_and_remove() to return
error or success so that sysfs_remove_bin_file() can do as you suggest.

WIP. (work-in-progress, not a whip)

---
~Randy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-07-11 02:37    [W:0.125 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site