summaryrefslogtreecommitdiff
path: root/drivers/platform/x86/think-lmi.c
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2023-03-29 04:50:25 +0000
committerHans de Goede <hdegoede@redhat.com>2023-04-06 12:43:58 +0200
commit3e9adae9336f1d530f342e5d5fbfc7d349f25b95 (patch)
tree1035f1d81be484b924907e713b3f50de3f7ee283 /drivers/platform/x86/think-lmi.c
parente82882cdd241b78d305df1441c624fbbbd07af05 (diff)
platform/x86: think-lmi: Remove unnecessary casts for attributes
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 <linux@weissschuh.net> Link: https://lore.kernel.org/r/20230329-think-lmi-attrs-v1-1-5794f2367cc2@weissschuh.net Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform/x86/think-lmi.c')
-rw-r--r--drivers/platform/x86/think-lmi.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
index cc66f7cbccf2..5a7ac5ca283c 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;