From: Hans de Goede <hdegoede@redhat.com>
To: "Thomas Weißschuh" <linux@weissschuh.net>,
"Mark Pearson" <markpearson@lenovo.com>,
"Mark Gross" <markgross@kernel.org>
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] platform/x86: think-lmi: Remove unnecessary casts for attributes
Date: Thu, 6 Apr 2023 12:44:30 +0200 [thread overview]
Message-ID: <c12fcff3-d9aa-2d8d-7053-224207defc26@redhat.com> (raw)
In-Reply-To: <20230329-think-lmi-attrs-v1-1-5794f2367cc2@weissschuh.net>
Hi,
On 3/29/23 06:50, Thomas Weißschuh wrote:
> 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>
Thank you for your patch, I've applied this patch to my review-hans
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.
Regards,
Hans
> ---
> drivers/platform/x86/think-lmi.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> 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;
>
> ---
> base-commit: fcd476ea6a888ef6e6627f4c21a2ea8cca3e9312
> change-id: 20230329-think-lmi-attrs-994abb757e98
>
> Best regards,
prev parent reply other threads:[~2023-04-06 10:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-29 4:50 [PATCH] platform/x86: think-lmi: Remove unnecessary casts for attributes Thomas Weißschuh
2023-04-06 10:44 ` Hans de Goede [this message]
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=c12fcff3-d9aa-2d8d-7053-224207defc26@redhat.com \
--to=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=markgross@kernel.org \
--cc=markpearson@lenovo.com \
--cc=platform-driver-x86@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).