Skip to content

Commit

Permalink
kobject: should use kobject_put() in kset-example
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Li Zefan authored and gregkh committed Jul 22, 2008
1 parent a231934 commit 185000f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion samples/kobject/kset-example.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
if (retval) {
kfree(foo);
kobject_put(&foo->kobj);
return NULL;
}

Expand Down

0 comments on commit 185000f

Please sign in to comment.