diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2008-06-13 11:09:16 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-07-21 21:54:56 -0700 |
commit | 185000fc556372b7fb7f26516c325f212030dbd3 (patch) | |
tree | 522e1a72bcf51c8160f48eb02e79c064ee7d7c9a | |
parent | a231934bdf086a4fefc0df06e669499125a9db6f (diff) | |
download | linux-3.10-185000fc556372b7fb7f26516c325f212030dbd3.tar.gz linux-3.10-185000fc556372b7fb7f26516c325f212030dbd3.tar.bz2 linux-3.10-185000fc556372b7fb7f26516c325f212030dbd3.zip |
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>
-rw-r--r-- | samples/kobject/kset-example.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/samples/kobject/kset-example.c b/samples/kobject/kset-example.c index b0a1b4fe658..7395c0bbae1 100644 --- a/samples/kobject/kset-example.c +++ b/samples/kobject/kset-example.c @@ -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; } |