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

platform/x86: dell-ddv: Improve error handling

If for some reason a external function returns -ENODEV,
no error message is being displayed because the driver
assumes that -ENODEV can only be returned internally if
no sensors, etc where found.
Fix this by explicitly returning 0 in such a case since
missing hardware is no error. Also remove the now obsolete
check for -ENODEV.
Signed-off-by: default avatarArmin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20230707010333.12954-1-W_Armin@gmx.deReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 5d3acd9d
...@@ -616,7 +616,8 @@ static int dell_wmi_ddv_hwmon_add(struct dell_wmi_ddv_data *data) ...@@ -616,7 +616,8 @@ static int dell_wmi_ddv_hwmon_add(struct dell_wmi_ddv_data *data)
} }
if (index < 2) { if (index < 2) {
ret = -ENODEV; /* Finding no available sensors is not an error */
ret = 0;
goto err_release; goto err_release;
} }
...@@ -841,13 +842,13 @@ static int dell_wmi_ddv_probe(struct wmi_device *wdev, const void *context) ...@@ -841,13 +842,13 @@ static int dell_wmi_ddv_probe(struct wmi_device *wdev, const void *context)
if (IS_REACHABLE(CONFIG_ACPI_BATTERY)) { if (IS_REACHABLE(CONFIG_ACPI_BATTERY)) {
ret = dell_wmi_ddv_battery_add(data); ret = dell_wmi_ddv_battery_add(data);
if (ret < 0 && ret != -ENODEV) if (ret < 0)
dev_warn(&wdev->dev, "Unable to register ACPI battery hook: %d\n", ret); dev_warn(&wdev->dev, "Unable to register ACPI battery hook: %d\n", ret);
} }
if (IS_REACHABLE(CONFIG_HWMON)) { if (IS_REACHABLE(CONFIG_HWMON)) {
ret = dell_wmi_ddv_hwmon_add(data); ret = dell_wmi_ddv_hwmon_add(data);
if (ret < 0 && ret != -ENODEV) if (ret < 0)
dev_warn(&wdev->dev, "Unable to register hwmon interface: %d\n", ret); dev_warn(&wdev->dev, "Unable to register hwmon interface: %d\n", ret);
} }
......
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