Skip to content

Commit 0b9a1dc

Browse files
pobrnjwrdegoede
authored andcommitted
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: 1ac9abe ("platform/x86: huawei-wmi: Move to platform driver") Signed-off-by: Barnabás Pőcze <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent d6fef93 commit 0b9a1dc

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

drivers/platform/x86/huawei-wmi.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,9 @@ static int huawei_wmi_input_setup(struct device *dev,
760760
const char *guid,
761761
struct input_dev **idev)
762762
{
763+
acpi_status status;
764+
int err;
765+
763766
*idev = devm_input_allocate_device(dev);
764767
if (!*idev)
765768
return -ENOMEM;
@@ -769,10 +772,19 @@ static int huawei_wmi_input_setup(struct device *dev,
769772
(*idev)->id.bustype = BUS_HOST;
770773
(*idev)->dev.parent = dev;
771774

772-
return sparse_keymap_setup(*idev, huawei_wmi_keymap, NULL) ||
773-
input_register_device(*idev) ||
774-
wmi_install_notify_handler(guid, huawei_wmi_input_notify,
775-
*idev);
775+
err = sparse_keymap_setup(*idev, huawei_wmi_keymap, NULL);
776+
if (err)
777+
return err;
778+
779+
err = input_register_device(*idev);
780+
if (err)
781+
return err;
782+
783+
status = wmi_install_notify_handler(guid, huawei_wmi_input_notify, *idev);
784+
if (ACPI_FAILURE(status))
785+
return -EIO;
786+
787+
return 0;
776788
}
777789

778790
static void huawei_wmi_input_exit(struct device *dev, const char *guid)

0 commit comments

Comments
 (0)