* [PATCH] driver core: class: remove boilerplate code
@ 2023-10-20 16:00 Maurizio Lombardi
0 siblings, 0 replies; only message in thread
From: Maurizio Lombardi @ 2023-10-20 16:00 UTC (permalink / raw)
To: gregkh; +Cc: rafael, linux-kernel
Jump to err_out to avoid duplicating the code.
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
drivers/base/class.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 05d9df90f621..7e78aee0fd6c 100644
--- 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;
--
2.39.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-10-20 16:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-20 16:00 [PATCH] driver core: class: remove boilerplate code Maurizio Lombardi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®