Skip to content

Commit

Permalink
driver core: class: remove boilerplate code
Browse files Browse the repository at this point in the history
Jump to err_out to avoid duplicating the code.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Link: https://lore.kernel.org/r/20231020160042.759439-1-mlombard@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
maurizio-lombardi authored and gregkh committed Oct 21, 2023
1 parent 36b2d7d commit 28f2d57
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/base/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,8 @@ int class_register(const struct class *cls)
lockdep_register_key(key);
__mutex_init(&cp->mutex, "subsys mutex", key);
error = kobject_set_name(&cp->subsys.kobj, "%s", cls->name);
if (error) {
kfree(cp);
return error;
}
if (error)
goto err_out;

cp->subsys.kobj.kset = class_kset;
cp->subsys.kobj.ktype = &class_ktype;
Expand Down

0 comments on commit 28f2d57

Please sign in to comment.