Skip to content

Commit 9ddb00a

Browse files
spandruvadarafaeljw
authored andcommitted
ACPI: fan: Fix error reporting to user space
When user get/set cur_state fails, it should be some negative error value instead of whatever returned by acpi_evaluate_object() or from acpi_execute_simple_method(). The return value from these apis is some positive values greater than 0. For example if AE_NOT_FOUND is returned it will be "5". In other ACPI drivers, -ENODEV is returned when ACPI_FAILURE(status) is true. Do the same thing here for thermal sysfs callbacks for get and set for failures. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent cfb9244 commit 9ddb00a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/acpi/fan.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static int fan_get_state_acpi4(struct acpi_device *device, unsigned long *state)
107107
status = acpi_evaluate_object(device->handle, "_FST", NULL, &buffer);
108108
if (ACPI_FAILURE(status)) {
109109
dev_err(&device->dev, "Get fan state failed\n");
110-
return status;
110+
return -ENODEV;
111111
}
112112

113113
obj = buffer.pointer;
@@ -195,7 +195,7 @@ static int fan_set_state_acpi4(struct acpi_device *device, unsigned long state)
195195
fan->fps[state].control);
196196
if (ACPI_FAILURE(status)) {
197197
dev_dbg(&device->dev, "Failed to set state by _FSL\n");
198-
return status;
198+
return -ENODEV;
199199
}
200200

201201
return 0;

0 commit comments

Comments
 (0)