提交 185000fc 编写于 作者: L Li Zefan 提交者: Greg Kroah-Hartman

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: NLi Zefan <lizf@cn.fujitsu.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 a231934b
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册