Commit c5e160ff authored by Armin Wolf's avatar Armin Wolf Committed by Hans de Goede

platform/x86: xiaomi-wmi: Drop unnecessary NULL checks

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: default avatarArmin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20240402143059.8456-3-W_Armin@gmx.deReviewed-by: default avatarKuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 290680c2
...@@ -38,7 +38,7 @@ static int xiaomi_wmi_probe(struct wmi_device *wdev, const void *context) ...@@ -38,7 +38,7 @@ static int xiaomi_wmi_probe(struct wmi_device *wdev, const void *context)
struct xiaomi_wmi *data; struct xiaomi_wmi *data;
int ret; int ret;
if (wdev == NULL || context == NULL) if (!context)
return -EINVAL; return -EINVAL;
data = devm_kzalloc(&wdev->dev, sizeof(struct xiaomi_wmi), GFP_KERNEL); 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) ...@@ -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) static void xiaomi_wmi_notify(struct wmi_device *wdev, union acpi_object *dummy)
{ {
struct xiaomi_wmi *data; struct xiaomi_wmi *data = dev_get_drvdata(&wdev->dev);
if (wdev == NULL)
return;
data = dev_get_drvdata(&wdev->dev);
if (data == NULL)
return;
mutex_lock(&data->key_lock); mutex_lock(&data->key_lock);
input_report_key(data->input_dev, data->key_code, 1); input_report_key(data->input_dev, data->key_code, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment