From patchwork Wed Mar 29 04:50:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13191874 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8F28C6FD18 for ; Wed, 29 Mar 2023 04:50:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229457AbjC2Eud (ORCPT ); Wed, 29 Mar 2023 00:50:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjC2Euc (ORCPT ); Wed, 29 Mar 2023 00:50:32 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 209662D46; Tue, 28 Mar 2023 21:50:30 -0700 (PDT) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1680065428; bh=3uDKL3dxAD8wUGaHcCtXGJ0ik0XhHCgJ0XsIoOMR6mg=; h=From:Date:Subject:To:Cc:From; b=bsYwTtfS+4xkWfPFqC/VUCJHKjRkhFCGJa9s8462OKpDQOGfGablzqi7G1aSPs2qq xH4JGx04WWJFBXkIv86/0xZEVopT3qol6ylsVdkPNVTf7ghf0yiQB2R8NAP+TTAwyY 4qJKH1QB5MUYwxaUEFn9+s0cJuhmbeBoBg47j4PQ= Date: Wed, 29 Mar 2023 04:50:25 +0000 Subject: [PATCH] platform/x86: think-lmi: Remove unnecessary casts for attributes MIME-Version: 1.0 Message-Id: <20230329-think-lmi-attrs-v1-1-5794f2367cc2@weissschuh.net> X-B4-Tracking: v=1; b=H4sIAJDDI2QC/x2N0QrCMAwAf2Xk2cDsJrP+iviQbtEGa5SmijD27 wYf7+C4FYyrsMGpW6HyR0ye6rDfdTBn0hujLM4Q+jD0Q4jYsugdy0OQWquGMY6U0nSYOB7Bq0T GmCrpnL3TdykuX5Wv8v1vzpdt+wFpjO6TdgAAAA== To: Mark Pearson , Hans de Goede , Mark Gross Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1680065425; l=1970; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=3uDKL3dxAD8wUGaHcCtXGJ0ik0XhHCgJ0XsIoOMR6mg=; b=VLmT86d5sNkUhvSPhj+1JdaQQqAB7clQbigXTWogDddXcTmRsmJVLQ8BL/b79XBx3jqBPxDaP SPk90swaAUFCYYddQGWptkFLOYldeyfQx+s3teWsmFooWrN8KSPdJ0M X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org These casts are unnecessary and could break if structure layouts are randomized or implementation details change. Use the proper syntax that works without casts. Also remove some unnecessary braces that checkpatch complains about. Signed-off-by: Thomas Weißschuh --- drivers/platform/x86/think-lmi.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) --- base-commit: fcd476ea6a888ef6e6627f4c21a2ea8cca3e9312 change-id: 20230329-think-lmi-attrs-994abb757e98 Best regards, diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c index c816646eb661..02bfd6e3fed2 100644 --- a/drivers/platform/x86/think-lmi.c +++ b/drivers/platform/x86/think-lmi.c @@ -862,19 +862,18 @@ static umode_t auth_attr_is_visible(struct kobject *kobj, struct tlmi_pwd_setting *setting = to_tlmi_pwd_setting(kobj); /* We only want to display level and index settings on HDD/NVMe */ - if ((attr == (struct attribute *)&auth_index) || - (attr == (struct attribute *)&auth_level)) { + if (attr == &auth_index.attr || attr == &auth_level.attr) { if ((setting == tlmi_priv.pwd_hdd) || (setting == tlmi_priv.pwd_nvme)) return attr->mode; return 0; } /* We only display certificates on Admin account, if supported */ - if ((attr == (struct attribute *)&auth_certificate) || - (attr == (struct attribute *)&auth_signature) || - (attr == (struct attribute *)&auth_save_signature) || - (attr == (struct attribute *)&auth_cert_thumb) || - (attr == (struct attribute *)&auth_cert_to_password)) { + if (attr == &auth_certificate.attr || + attr == &auth_signature.attr || + attr == &auth_save_signature.attr || + attr == &auth_cert_thumb.attr || + attr == &auth_cert_to_password.attr) { if ((setting == tlmi_priv.pwd_admin) && tlmi_priv.certificate_support) return attr->mode; return 0;