Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c60f114 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Rafael J. Wysocki
Browse files

device property: return -EINVAL when property isn't found in ACPI



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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 1d656fb7
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -346,7 +346,7 @@ void acpi_free_properties(struct acpi_device *adev)
 *
 *
 * Return: %0 if property with @name has been found (success),
 * Return: %0 if property with @name has been found (success),
 *         %-EINVAL if the arguments are invalid,
 *         %-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.
 *         %-EPROTO if the property value type doesn't match @type.
 */
 */
static int acpi_data_get_property(struct acpi_device_data *data,
static int acpi_data_get_property(struct acpi_device_data *data,
@@ -360,7 +360,7 @@ static int acpi_data_get_property(struct acpi_device_data *data,
		return -EINVAL;
		return -EINVAL;


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


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


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


/**
/**
@@ -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),
 * Return: %0 if array property (package) with @name has been found (success),
 *         %-EINVAL if the arguments are invalid,
 *         %-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
 *         %-EPROTO if the property is not a package or the type of its elements
 *           doesn't match @type.
 *           doesn't match @type.
 */
 */