Skip to content

Commit

Permalink
device property: return -EINVAL when property isn't found in ACPI
Browse files Browse the repository at this point in the history
Change return code to be in align with OF and built-in device properties error
codes. In particular -EINVAL means property is not found.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Andy Shevchenko authored and Rafael J. Wysocki committed Dec 7, 2015
1 parent 1d656fb commit 3c60f11
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/acpi/property.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ void acpi_free_properties(struct acpi_device *adev)
*
* Return: %0 if property with @name has been found (success),
* %-EINVAL if the arguments are invalid,
* %-ENODATA if the property doesn't exist,
* %-EINVAL if the property doesn't exist,
* %-EPROTO if the property value type doesn't match @type.
*/
static int acpi_data_get_property(struct acpi_device_data *data,
Expand All @@ -360,7 +360,7 @@ static int acpi_data_get_property(struct acpi_device_data *data,
return -EINVAL;

if (!data->pointer || !data->properties)
return -ENODATA;
return -EINVAL;

properties = data->properties;
for (i = 0; i < properties->package.count; i++) {
Expand All @@ -375,13 +375,13 @@ static int acpi_data_get_property(struct acpi_device_data *data,
if (!strcmp(name, propname->string.pointer)) {
if (type != ACPI_TYPE_ANY && propvalue->type != type)
return -EPROTO;
else if (obj)
if (obj)
*obj = propvalue;

return 0;
}
}
return -ENODATA;
return -EINVAL;
}

/**
Expand Down Expand Up @@ -439,7 +439,7 @@ int acpi_node_prop_get(struct fwnode_handle *fwnode, const char *propname,
*
* Return: %0 if array property (package) with @name has been found (success),
* %-EINVAL if the arguments are invalid,
* %-ENODATA if the property doesn't exist,
* %-EINVAL if the property doesn't exist,
* %-EPROTO if the property is not a package or the type of its elements
* doesn't match @type.
*/
Expand Down

0 comments on commit 3c60f11

Please sign in to comment.