mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 11:16:11 +00:00
kobject: should use kobject_put() in kset-example
We should call kobject_put() instead of kfree() if kobject_init_and_add() returns an error, shouldn't we? Don't set up a bad example ;) Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
a231934bdf
commit
185000fc55
1 changed files with 1 additions and 1 deletions
|
@ -211,7 +211,7 @@ static struct foo_obj *create_foo_obj(const char *name)
|
||||||
*/
|
*/
|
||||||
retval = kobject_init_and_add(&foo->kobj, &foo_ktype, NULL, "%s", name);
|
retval = kobject_init_and_add(&foo->kobj, &foo_ktype, NULL, "%s", name);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
kfree(foo);
|
kobject_put(&foo->kobj);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue