lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 2 Apr 2024 14:16:53 -0700
From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>
To: Armin Wolf <W_Armin@....de>, hdegoede@...hat.com,
 ilpo.jarvinen@...ux.intel.com
Cc: corbet@....net, linux-doc@...r.kernel.org,
 platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/4] platform/x86: xiaomi-wmi: Drop unnecessary NULL
 checks


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@....de>
> ---

LGTM

Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ