Commit 28f2d57d authored by Maurizio Lombardi's avatar Maurizio Lombardi Committed by Greg Kroah-Hartman

driver core: class: remove boilerplate code

Jump to err_out to avoid duplicating the code.
Signed-off-by: default avatarMaurizio Lombardi <mlombard@redhat.com>
Link: https://lore.kernel.org/r/20231020160042.759439-1-mlombard@redhat.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 36b2d7dd
...@@ -193,10 +193,8 @@ int class_register(const struct class *cls) ...@@ -193,10 +193,8 @@ int class_register(const struct class *cls)
lockdep_register_key(key); lockdep_register_key(key);
__mutex_init(&cp->mutex, "subsys mutex", key); __mutex_init(&cp->mutex, "subsys mutex", key);
error = kobject_set_name(&cp->subsys.kobj, "%s", cls->name); error = kobject_set_name(&cp->subsys.kobj, "%s", cls->name);
if (error) { if (error)
kfree(cp); goto err_out;
return error;
}
cp->subsys.kobj.kset = class_kset; cp->subsys.kobj.kset = class_kset;
cp->subsys.kobj.ktype = &class_ktype; cp->subsys.kobj.ktype = &class_ktype;
......
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