summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorBarnabás Pőcze <pobrn@protonmail.com>2021-02-04 00:54:30 +0300
committerHans de Goede <hdegoede@redhat.com>2021-02-04 12:20:16 +0300
commit803be832ac5698f54afa0c10458f59ce4104aa0f (patch)
tree85c77063d49f0c733e04307e430a028b2c334e84 /drivers
parente1a39a4460c17fa397020cd064744a908e2eac71 (diff)
downloadlinux-803be832ac5698f54afa0c10458f59ce4104aa0f.tar.xz
platform/x86: ideapad-laptop: use appropriately typed variable to store the return value of ACPI methods
Use a variable with type `acpi_status` to store the return value of ACPI methods instead of a plain `int`. And use ACPI_{SUCCESS,FAILURE} macros where possible instead of direct comparison. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210203215403.290792-4-pobrn@protonmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/platform/x86/ideapad-laptop.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 415d362a642a..6c1ed5153a37 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -1247,6 +1247,7 @@ static int ideapad_acpi_add(struct platform_device *pdev)
int cfg;
struct ideapad_private *priv;
struct acpi_device *adev;
+ acpi_status status;
ret = acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev);
if (ret)
@@ -1303,22 +1304,27 @@ static int ideapad_acpi_add(struct platform_device *pdev)
if (ret && ret != -ENODEV)
goto backlight_failed;
}
- ret = acpi_install_notify_handler(adev->handle,
- ACPI_DEVICE_NOTIFY, ideapad_acpi_notify, priv);
- if (ret)
+ status = acpi_install_notify_handler(adev->handle,
+ ACPI_DEVICE_NOTIFY,
+ ideapad_acpi_notify, priv);
+ if (ACPI_FAILURE(status)) {
+ ret = -EIO;
goto notification_failed;
+ }
#if IS_ENABLED(CONFIG_ACPI_WMI)
for (i = 0; i < ARRAY_SIZE(ideapad_wmi_fnesc_events); i++) {
- ret = wmi_install_notify_handler(ideapad_wmi_fnesc_events[i],
- ideapad_wmi_notify, priv);
- if (ret == AE_OK) {
+ status = wmi_install_notify_handler(ideapad_wmi_fnesc_events[i],
+ ideapad_wmi_notify, priv);
+ if (ACPI_SUCCESS(status)) {
priv->fnesc_guid = ideapad_wmi_fnesc_events[i];
break;
}
}
- if (ret != AE_OK && ret != AE_NOT_EXIST)
+ if (ACPI_FAILURE(status) && status != AE_NOT_EXIST) {
+ ret = -EIO;
goto notification_failed_wmi;
+ }
#endif
return 0;