Commit 0b9a1dcd authored by Barnabás Pőcze's avatar Barnabás Pőcze Committed by Hans de Goede

platform/x86: huawei-wmi: fix return value calculation

Previously, `huawei_wmi_input_setup()` returned the result of
logical or-ing the return values of two functions that return negative
errno-style error codes and one that returns `acpi_status`. If this
returned value was non-zero, then it was propagated from the platform
driver's probe function. That function should return a negative
errno-style error code, so the result of the logical or that
`huawei_wmi_input_setup()` returned was not appropriate.

Fix that by checking each function separately and returning the
error code unmodified.

Fixes: 1ac9abeb ("platform/x86: huawei-wmi: Move to platform driver")
Signed-off-by: default avatarBarnabás Pőcze <pobrn@protonmail.com>
Link: https://lore.kernel.org/r/20221005150032.173198-2-pobrn@protonmail.comReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent d6fef932
...@@ -760,6 +760,9 @@ static int huawei_wmi_input_setup(struct device *dev, ...@@ -760,6 +760,9 @@ static int huawei_wmi_input_setup(struct device *dev,
const char *guid, const char *guid,
struct input_dev **idev) struct input_dev **idev)
{ {
acpi_status status;
int err;
*idev = devm_input_allocate_device(dev); *idev = devm_input_allocate_device(dev);
if (!*idev) if (!*idev)
return -ENOMEM; return -ENOMEM;
...@@ -769,10 +772,19 @@ static int huawei_wmi_input_setup(struct device *dev, ...@@ -769,10 +772,19 @@ static int huawei_wmi_input_setup(struct device *dev,
(*idev)->id.bustype = BUS_HOST; (*idev)->id.bustype = BUS_HOST;
(*idev)->dev.parent = dev; (*idev)->dev.parent = dev;
return sparse_keymap_setup(*idev, huawei_wmi_keymap, NULL) || err = sparse_keymap_setup(*idev, huawei_wmi_keymap, NULL);
input_register_device(*idev) || if (err)
wmi_install_notify_handler(guid, huawei_wmi_input_notify, return err;
*idev);
err = input_register_device(*idev);
if (err)
return err;
status = wmi_install_notify_handler(guid, huawei_wmi_input_notify, *idev);
if (ACPI_FAILURE(status))
return -EIO;
return 0;
} }
static void huawei_wmi_input_exit(struct device *dev, const char *guid) static void huawei_wmi_input_exit(struct device *dev, const char *guid)
......
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