Messages in this thread | | | Date | Fri, 12 Jul 2013 07:45:21 +0800 | From | Chen Gang <> | Subject | Re: [PATCH] kernel/params.c: print failure information instead of 'KOBJ_ADD' to user space, when sysfs_create_file() fails. |
| |
On 07/10/2013 11:01 AM, Chen Gang F T wrote: > >> > Hmm..., do we need call kobject_get() before kobject_put() in failure >> > processing block ? >> > > Oh, sorry for what I said for kobject_get/put() items above, it is > incorrect. > > What about the diff below for kobject_get() ? > > -------------------------------diff begin------------------------------- > > diff --git a/kernel/params.c b/kernel/params.c > index 440e65d..ef8d720 100644 > --- a/kernel/params.c > +++ b/kernel/params.c > @@ -754,11 +754,11 @@ static struct module_kobject * __init locate_module_kobject(const char *name) > name, err); > return NULL; > } > - > - /* So that we hold reference in both cases. */ > - kobject_get(&mk->kobj); > } > > + /* So that we hold reference in both cases. */ > + kobject_get(&mk->kobj); > + > return mk; > } > > -------------------------------diff end--------------------------------- >
Sorry again, this diff is incorrect, the original implementation has no issues.
> And it also need add additional kobject_put(), if we really need > process the failure in version_sysfs_builtin().
If need process failure, we really need it, but now, we only use BUG_ON() is enough.
Thanks. -- Chen Gang
| |