From nobody Mon Feb 9 12:15:46 2026 Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DD9C34AB1C for ; Tue, 23 Dec 2025 19:24:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766517855; cv=none; b=ut4QTfCK2L2nbWB5AGl3+sTkGv7NBAEw4JQXmcMQtK3nVUi8/OpUH0Xtb/RjgZokegPlrApJrahDZVYTiGgyF94dAusq3D1Mp3YsE2tMfGdlxUTE2NSoWM3Bt3wNZmTzXou6dhJgwwIGZmmbhZY1qqO9Erl3rNXQvQQP+k5i0Dc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766517855; c=relaxed/simple; bh=ytxYq5dumOjUM+zW47/QayeuiSLcWk0I4K5pUD//gP0=; h=From:In-Reply-To:References:MIME-Version:Date:Message-ID:Subject: To:Cc:Content-Type; b=k6rddAuW1ixzLE0X0vWMW7dcHi4FdflrLrNIOdbJzgxTA9hTS4IdcI2cWoA9zO71rKZJtnN7PqrKB3R8ZuZ4VtQPpw9Zk6GCn4+K7uemV1VkkonUmIKu8BtXEs1sqP43tS8AWATj8zbepY65FkFCvyl9PSbwI/X0hx4+crbLJM0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Bo+Bq6cF; arc=none smtp.client-ip=209.85.208.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Bo+Bq6cF" Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-37d275cb96cso49062531fa.2 for ; Tue, 23 Dec 2025 11:24:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766517850; x=1767122650; darn=vger.kernel.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=c2wz1QtkrmyGbQChH9BPNFA2K4rppg6qm6bIfWePGFI=; b=Bo+Bq6cFwnDbCofk/fH3Fk0llWariS2BeqZHdGcyO61mrJQ+1zoTu+bveK9nz+ITWp B7Ozl0/Tr3DdBuCLaxMSd7zuVDSKsWSFYpo2+7ej2Wm7VJV43Ycf1KYl2J/CeVnmnQJ5 NhM6yn4jzsvEl/K2hqnx96TFCoLyZWViM+ljV6Luc1bg9UREXVsyg5PTGevv7tsfkLQm NenK3Uflf+Y9nJuvNz04TB4VlNlhY9MK4jSVpmPnw8ihmCw5NVALRXkdKC+C65tQmfb7 DM60a3fKnRRdiet4fmBpsn6nYy0GSn6y3yb/bsV4tfkmDWf9BGU4ei5eOMI/EJaGOL8W tyRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766517850; x=1767122650; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=c2wz1QtkrmyGbQChH9BPNFA2K4rppg6qm6bIfWePGFI=; b=nlT48N+Z2x+Xzru8KXgWtnvHhIKd37G5O96Yf0VaSx/1S888Pnl87H8UPUo5lfzJPn LZVdlRVsUU2zx9WGnrrsU2CNNLXd78tENis4JPzk0A265kphyj+LlSrGBpACOlCJIDhq HP/9kT1OfuA/1DgfTxI8x4QvIVRHp43LIKK/vQ5DPdv70BwezqdulX5XmlmXgW5Qji1o S25gnPPLAZnaa2NuUt+ePG0/Dk284PHMvFdN+YzHZFMKdjvPcok91GdD/rTgP4HDws8B oYESFSWB2KxPDKLpNyoF4/WHStVaHSRiRLhDusNBRFZCYd153oMm69SxL5nFesIdkJfK s2xw== X-Forwarded-Encrypted: i=1; AJvYcCWhZawPAiM05kcDwJ8qwmYDIt4jXGU+6p0sTQjgReZZQcI8VFnJgZeGt4jCv+ECieUDXqFop3Q3eykspFc=@vger.kernel.org X-Gm-Message-State: AOJu0YyMS2LCqrOYsrq3pnexL1c3fKcE2AfcXKQtanGxUX4qY+eifP0I IMlZilGxbsFgtkIpROOolOUzyki8lwWLGdpRpOKdTPBEXN+PdGhHWJkq05PoeanfG52cns3akmA 9yae8K5vRXci8i0KvGxi+G+Py9GgCF4U= X-Gm-Gg: AY/fxX5h/Ei6H9AnM8OUiXGKpL2BlUBG4TuEa/2mUIGIUSMplDxl75LqgNajowV73c6 CX+IBfotU3j+XFkwFtLJprc9BsAqeglEJiayJj1N2Skczu6C00NyUbODM1SmEuZb+qNJouRIbUT kYZgYYGESVc0Iks6D1IRiZW2mFDmn/Q3blfWe2y0qEAbYpp/TlYvkFufEEI8ZlJipPGT+d1qon/ sMfcF/eOOJB3CSqrjEwfPRfx2nrCU2LbxkqfvjNUX3LcHdK2V6tD/hMJm+G+MTi/dQ7QNlu4fDi t2nRVA== X-Google-Smtp-Source: AGHT+IEEGYGEeljB1FPaBLu3wRjlyXq/Y7VzSElMupYoOp8z8/S9m1pS1SJoewIIzXL8xmdMCFqLXk6xb5T2Si7cLt8= X-Received: by 2002:a05:651c:b12:b0:37f:825c:dcc4 with SMTP id 38308e7fff4ca-38121687cebmr45110391fa.35.1766517850057; Tue, 23 Dec 2025 11:24:10 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 23 Dec 2025 11:24:09 -0800 Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 23 Dec 2025 11:24:09 -0800 From: Benjamin Philip X-Mailer: git-send-email 2.52.0 In-Reply-To: References: <20251223191932.946794-1-benjamin.philip495@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Tue, 23 Dec 2025 11:24:09 -0800 X-Gm-Features: AQt7F2pi2TrRdIWsoWP-UTz2ZHLDj1b6QeZ1IJWWrXkB8qv-EX1kkbtANMpo3hc Message-ID: Subject: [PATCH 3/5] platform/x86: think-lmi: Clean up misc checks To: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mark Pearson , "Derek J. Clark" , Hans de Goede , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , Benjamin Philip Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This commit cleans up the following checks: - CHECK: braces {} should be used on all arms of this statement - CHECK: Please use a blank line after function/struct/union/enum declarations - CHECK: Prefer kzalloc(sizeof(*new_pwd)...) over kzalloc(sizeof(struct tlmi_pwd_setting)...) - CHECK: spaces preferred around that '/' (ctx:VxV) - CHECK: Unbalanced braces around else statement Signed-off-by: Benjamin Philip --- drivers/platform/x86/lenovo/think-lmi.c | 32 +++++++++++++------------ 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/drivers/platform/x86/lenovo/think-lmi.c b/drivers/platform/x86/lenovo/think-lmi.c index 1fac8986d077..1ada4d800383 100644 --- a/drivers/platform/x86/lenovo/think-lmi.c +++ b/drivers/platform/x86/lenovo/think-lmi.c @@ -223,14 +223,16 @@ static const struct tlmi_err_codes tlmi_errs[] =3D { {"Set Certificate operation failed with status:Certificate too large.", -EFBIG}, }; -static const char * const encoding_options[] =3D { +static const char *const encoding_options[] =3D { [TLMI_ENCODING_ASCII] =3D "ascii", [TLMI_ENCODING_SCANCODE] =3D "scancode", }; -static const char * const level_options[] =3D { + +static const char *const level_options[] =3D { [TLMI_LEVEL_USER] =3D "user", [TLMI_LEVEL_MASTER] =3D "master", }; + static struct think_lmi tlmi_priv; static DEFINE_MUTEX(tlmi_mutex); @@ -249,7 +251,7 @@ static int tlmi_errstr_to_err(const char *errstr) { int i; - for (i =3D 0; i < sizeof(tlmi_errs)/sizeof(struct tlmi_err_codes); i++) { + for (i =3D 0; i < sizeof(tlmi_errs) / sizeof(struct tlmi_err_codes); i++)= { if (!strcmp(tlmi_errs[i].err_str, errstr)) return tlmi_errs[i].err_code; } @@ -570,19 +572,19 @@ static ssize_t mechanism_show(struct kobject *kobj, struct kobj_attribute *attr, return sysfs_emit(buf, "certificate\n"); return sysfs_emit(buf, "password\n"); } + static struct kobj_attribute auth_mechanism =3D __ATTR_RO(mechanism); static ssize_t encoding_show(struct kobject *kobj, struct kobj_attribute *= attr, - char *buf) + char *buf) { struct tlmi_pwd_setting *setting =3D to_tlmi_pwd_setting(kobj); return sysfs_emit(buf, "%s\n", encoding_options[setting->encoding]); } -static ssize_t encoding_store(struct kobject *kobj, - struct kobj_attribute *attr, - const char *buf, size_t count) +static ssize_t encoding_store(struct kobject *kobj, struct kobj_attribute *attr, + const char *buf, size_t count) { struct tlmi_pwd_setting *setting =3D to_tlmi_pwd_setting(kobj); int i; @@ -632,19 +634,19 @@ static ssize_t role_show(struct kobject *kobj, struct kobj_attribute *attr, return sysfs_emit(buf, "%s\n", setting->role); } + static struct kobj_attribute auth_role =3D __ATTR_RO(role); static ssize_t index_show(struct kobject *kobj, struct kobj_attribute *att= r, - char *buf) + char *buf) { struct tlmi_pwd_setting *setting =3D to_tlmi_pwd_setting(kobj); return sysfs_emit(buf, "%d\n", setting->index); } -static ssize_t index_store(struct kobject *kobj, - struct kobj_attribute *attr, - const char *buf, size_t count) +static ssize_t index_store(struct kobject *kobj, struct kobj_attribute *at= tr, + const char *buf, size_t count) { struct tlmi_pwd_setting *setting =3D to_tlmi_pwd_setting(kobj); int err, val; @@ -1047,9 +1049,9 @@ static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *a /* validate and split from `item,value` -> `value` */ value =3D strpbrk(item, ","); - if (!value || value =3D=3D item || !strlen(value + 1)) + if (!value || value =3D=3D item || !strlen(value + 1)) { ret =3D -EINVAL; - else { + } else { /* On Workstations remove the Options part after the value */ strreplace(value, ';', '\0'); ret =3D sysfs_emit(buf, "%s\n", value + 1); @@ -1585,11 +1587,11 @@ static int tlmi_sysfs_init(void) /* ---- Base Driver ------------------------------------------------------= -- */ static struct tlmi_pwd_setting *tlmi_create_auth(const char *pwd_type, - const char *pwd_role) + const char *pwd_role) { struct tlmi_pwd_setting *new_pwd; - new_pwd =3D kzalloc(sizeof(struct tlmi_pwd_setting), GFP_KERNEL); + new_pwd =3D kzalloc(sizeof(*new_pwd), GFP_KERNEL); if (!new_pwd) return NULL; --=20 2.52.0