From: Kurt Borja <kuurtb@gmail.com>
To: "Mark Pearson" <mpearson-lenovo@squebb.ca>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Hans de Goede" <hansg@kernel.org>
Cc: platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, Kurt Borja <kuurtb@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH v3 1/3] platform/x86: think-lmi: Create ksets consecutively
Date: Mon, 30 Jun 2025 14:31:19 -0300 [thread overview]
Message-ID: <20250630-lmi-fix-v3-1-ce4f81c9c481@gmail.com> (raw)
In-Reply-To: <20250630-lmi-fix-v3-0-ce4f81c9c481@gmail.com>
Avoid entering tlmi_release_attr() in error paths if both ksets are not
yet created.
This is accomplished by initializing them side by side.
Cc: stable@vger.kernel.org
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Kurt Borja <kuurtb@gmail.com>
---
drivers/platform/x86/think-lmi.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
index 00b1e7c79a3d1e95621701530ea5e11015414498..4c10a26e7e5e3471f286136d671606acf68b401e 100644
--- a/drivers/platform/x86/think-lmi.c
+++ b/drivers/platform/x86/think-lmi.c
@@ -1455,6 +1455,14 @@ static int tlmi_sysfs_init(void)
goto fail_device_created;
}
+ tlmi_priv.authentication_kset = kset_create_and_add("authentication", NULL,
+ &tlmi_priv.class_dev->kobj);
+ if (!tlmi_priv.authentication_kset) {
+ kset_unregister(tlmi_priv.attribute_kset);
+ ret = -ENOMEM;
+ goto fail_device_created;
+ }
+
for (i = 0; i < TLMI_SETTINGS_COUNT; i++) {
/* Check if index is a valid setting - skip if it isn't */
if (!tlmi_priv.setting[i])
@@ -1496,12 +1504,6 @@ static int tlmi_sysfs_init(void)
}
/* Create authentication entries */
- tlmi_priv.authentication_kset = kset_create_and_add("authentication", NULL,
- &tlmi_priv.class_dev->kobj);
- if (!tlmi_priv.authentication_kset) {
- ret = -ENOMEM;
- goto fail_create_attr;
- }
tlmi_priv.pwd_admin->kobj.kset = tlmi_priv.authentication_kset;
ret = kobject_add(&tlmi_priv.pwd_admin->kobj, NULL, "%s", "Admin");
if (ret)
--
2.50.0
next prev parent reply other threads:[~2025-06-30 17:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-30 17:31 [PATCH v3 0/3] platform/x86: think-lmi: Fix resource cleanup flaws Kurt Borja
2025-06-30 17:31 ` Kurt Borja [this message]
2025-06-30 17:31 ` [PATCH v3 2/3] platform/x86: think-lmi: Fix kobject cleanup Kurt Borja
2025-06-30 17:31 ` [PATCH v3 3/3] platform/x86: think-lmi: Fix sysfs group cleanup Kurt Borja
2025-07-02 9:01 ` [PATCH v3 0/3] platform/x86: think-lmi: Fix resource cleanup flaws Ilpo Järvinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250630-lmi-fix-v3-1-ce4f81c9c481@gmail.com \
--to=kuurtb@gmail.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpearson-lenovo@squebb.ca \
--cc=platform-driver-x86@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).