Skip to content

Commit 28f2d57

Browse files
maurizio-lombardigregkh
authored andcommitted
driver core: class: remove boilerplate code
Jump to err_out to avoid duplicating the code. Signed-off-by: Maurizio Lombardi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 36b2d7d commit 28f2d57

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/base/class.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,8 @@ int class_register(const struct class *cls)
193193
lockdep_register_key(key);
194194
__mutex_init(&cp->mutex, "subsys mutex", key);
195195
error = kobject_set_name(&cp->subsys.kobj, "%s", cls->name);
196-
if (error) {
197-
kfree(cp);
198-
return error;
199-
}
196+
if (error)
197+
goto err_out;
200198

201199
cp->subsys.kobj.kset = class_kset;
202200
cp->subsys.kobj.ktype = &class_ktype;

0 commit comments

Comments
 (0)