projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
36b2d7d
)
driver core: class: remove boilerplate code
author
Maurizio Lombardi
<mlombard@redhat.com>
Fri, 20 Oct 2023 16:00:42 +0000
(18:00 +0200)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Sat, 21 Oct 2023 21:17:11 +0000
(23:17 +0200)
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>
drivers/base/class.c
patch
|
blob
|
history
diff --git
a/drivers/base/class.c
b/drivers/base/class.c
index 05d9df90f621be89cdbd7d1ecee888c18a6b688b..7e78aee0fd6c397a5c121e8365735e35664925d2 100644
(file)
--- a/
drivers/base/class.c
+++ b/
drivers/base/class.c
@@
-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;