From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
To: Armin Wolf <W_Armin@gmx.de>,
hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com
Cc: corbet@lwn.net, linux-doc@vger.kernel.org,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/4] platform/x86: xiaomi-wmi: Drop unnecessary NULL checks
Date: Tue, 2 Apr 2024 14:16:53 -0700 [thread overview]
Message-ID: <6a401cbb-efd0-475f-bc43-81041e908698@linux.intel.com> (raw)
In-Reply-To: <20240402143059.8456-3-W_Armin@gmx.de>
On 4/2/24 7:30 AM, Armin Wolf wrote:
> The WMI driver core already makes sure that:
>
> - a valid WMI device is passed to each callback
> - the notify() callback runs after the probe() callback succeeds
>
> Remove the unnecessary NULL checks.
>
> Compile-tested only.
>
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
> ---
LGTM
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
> drivers/platform/x86/xiaomi-wmi.c | 11 ++---------
> 1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/platform/x86/xiaomi-wmi.c b/drivers/platform/x86/xiaomi-wmi.c
> index 7efbdc111803..cbed29ca502a 100644
> --- a/drivers/platform/x86/xiaomi-wmi.c
> +++ b/drivers/platform/x86/xiaomi-wmi.c
> @@ -38,7 +38,7 @@ static int xiaomi_wmi_probe(struct wmi_device *wdev, const void *context)
> struct xiaomi_wmi *data;
> int ret;
>
> - if (wdev == NULL || context == NULL)
> + if (!context)
> return -EINVAL;
>
> data = devm_kzalloc(&wdev->dev, sizeof(struct xiaomi_wmi), GFP_KERNEL);
> @@ -66,14 +66,7 @@ static int xiaomi_wmi_probe(struct wmi_device *wdev, const void *context)
>
> static void xiaomi_wmi_notify(struct wmi_device *wdev, union acpi_object *dummy)
> {
> - struct xiaomi_wmi *data;
> -
> - if (wdev == NULL)
> - return;
> -
> - data = dev_get_drvdata(&wdev->dev);
> - if (data == NULL)
> - return;
> + struct xiaomi_wmi *data = dev_get_drvdata(&wdev->dev);
>
> mutex_lock(&data->key_lock);
> input_report_key(data->input_dev, data->key_code, 1);
> --
> 2.39.2
>
>
--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
next prev parent reply other threads:[~2024-04-02 21:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-02 14:30 [PATCH v2 1/4] platform/x86: wmi: Mark simple WMI drivers as legacy-free Armin Wolf
2024-04-02 14:30 ` [PATCH v2 2/4] platform/x86: xiaomi-wmi: Fix race condition when reporting key events Armin Wolf
2024-04-02 21:17 ` Kuppuswamy Sathyanarayanan
2024-04-02 14:30 ` [PATCH v2 3/4] platform/x86: xiaomi-wmi: Drop unnecessary NULL checks Armin Wolf
2024-04-02 21:16 ` Kuppuswamy Sathyanarayanan [this message]
2024-04-02 14:30 ` [PATCH v2 4/4] platform/x86: wmi: Add driver development guide Armin Wolf
2024-04-02 21:16 ` Kuppuswamy Sathyanarayanan
2024-04-08 15:40 ` [PATCH v2 1/4] platform/x86: wmi: Mark simple WMI drivers as legacy-free Hans de Goede
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=6a401cbb-efd0-475f-bc43-81041e908698@linux.intel.com \
--to=sathyanarayanan.kuppuswamy@linux.intel.com \
--cc=W_Armin@gmx.de \
--cc=corbet@lwn.net \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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