Commit e756bc56 authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Greg Kroah-Hartman

kobject: fix kset sample error path

Previously, example_init() leaked a kset if any of the object creations
failed.  This fixes the leak by calling kset_unregister() in the error
path.
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bfc5c173
...@@ -262,6 +262,7 @@ static int __init example_init(void) ...@@ -262,6 +262,7 @@ static int __init example_init(void)
bar_error: bar_error:
destroy_foo_obj(foo_obj); destroy_foo_obj(foo_obj);
foo_error: foo_error:
kset_unregister(example_kset);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment