|
@@ -571,10 +571,9 @@ static int acpi_data_get_property_array(const struct acpi_device_data *data,
|
|
* }
|
|
* }
|
|
* }
|
|
* }
|
|
*
|
|
*
|
|
- * Calling this function with index %2 return %-ENOENT and with index %3
|
|
|
|
- * returns the last entry. If the property does not contain any more values
|
|
|
|
- * %-ENODATA is returned. The NULL entry must be single integer and
|
|
|
|
- * preferably contain value %0.
|
|
|
|
|
|
+ * Calling this function with index %2 or index %3 return %-ENOENT. If the
|
|
|
|
+ * property does not contain any more values %-ENOENT is returned. The NULL
|
|
|
|
+ * entry must be single integer and preferably contain value %0.
|
|
*
|
|
*
|
|
* Return: %0 on success, negative error code on failure.
|
|
* Return: %0 on success, negative error code on failure.
|
|
*/
|
|
*/
|
|
@@ -590,11 +589,11 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
|
|
|
|
|
|
data = acpi_device_data_of_node(fwnode);
|
|
data = acpi_device_data_of_node(fwnode);
|
|
if (!data)
|
|
if (!data)
|
|
- return -EINVAL;
|
|
|
|
|
|
+ return -ENOENT;
|
|
|
|
|
|
ret = acpi_data_get_property(data, propname, ACPI_TYPE_ANY, &obj);
|
|
ret = acpi_data_get_property(data, propname, ACPI_TYPE_ANY, &obj);
|
|
if (ret)
|
|
if (ret)
|
|
- return ret;
|
|
|
|
|
|
+ return ret == -EINVAL ? -ENOENT : -EINVAL;
|
|
|
|
|
|
/*
|
|
/*
|
|
* The simplest case is when the value is a single reference. Just
|
|
* The simplest case is when the value is a single reference. Just
|
|
@@ -606,7 +605,7 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
|
|
|
|
|
|
ret = acpi_bus_get_device(obj->reference.handle, &device);
|
|
ret = acpi_bus_get_device(obj->reference.handle, &device);
|
|
if (ret)
|
|
if (ret)
|
|
- return ret;
|
|
|
|
|
|
+ return ret == -ENODEV ? -EINVAL : ret;
|
|
|
|
|
|
args->adev = device;
|
|
args->adev = device;
|
|
args->nargs = 0;
|
|
args->nargs = 0;
|
|
@@ -622,8 +621,10 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
|
|
* The index argument is then used to determine which reference
|
|
* The index argument is then used to determine which reference
|
|
* the caller wants (along with the arguments).
|
|
* the caller wants (along with the arguments).
|
|
*/
|
|
*/
|
|
- if (obj->type != ACPI_TYPE_PACKAGE || index >= obj->package.count)
|
|
|
|
- return -EPROTO;
|
|
|
|
|
|
+ if (obj->type != ACPI_TYPE_PACKAGE)
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ if (index >= obj->package.count)
|
|
|
|
+ return -ENOENT;
|
|
|
|
|
|
element = obj->package.elements;
|
|
element = obj->package.elements;
|
|
end = element + obj->package.count;
|
|
end = element + obj->package.count;
|
|
@@ -635,7 +636,7 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
|
|
ret = acpi_bus_get_device(element->reference.handle,
|
|
ret = acpi_bus_get_device(element->reference.handle,
|
|
&device);
|
|
&device);
|
|
if (ret)
|
|
if (ret)
|
|
- return -ENODEV;
|
|
|
|
|
|
+ return -EINVAL;
|
|
|
|
|
|
nargs = 0;
|
|
nargs = 0;
|
|
element++;
|
|
element++;
|
|
@@ -649,11 +650,11 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
|
|
else if (type == ACPI_TYPE_LOCAL_REFERENCE)
|
|
else if (type == ACPI_TYPE_LOCAL_REFERENCE)
|
|
break;
|
|
break;
|
|
else
|
|
else
|
|
- return -EPROTO;
|
|
|
|
|
|
+ return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
if (nargs > MAX_ACPI_REFERENCE_ARGS)
|
|
if (nargs > MAX_ACPI_REFERENCE_ARGS)
|
|
- return -EPROTO;
|
|
|
|
|
|
+ return -EINVAL;
|
|
|
|
|
|
if (idx == index) {
|
|
if (idx == index) {
|
|
args->adev = device;
|
|
args->adev = device;
|
|
@@ -670,13 +671,13 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
|
|
return -ENOENT;
|
|
return -ENOENT;
|
|
element++;
|
|
element++;
|
|
} else {
|
|
} else {
|
|
- return -EPROTO;
|
|
|
|
|
|
+ return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
idx++;
|
|
idx++;
|
|
}
|
|
}
|
|
|
|
|
|
- return -ENODATA;
|
|
|
|
|
|
+ return -ENOENT;
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(__acpi_node_get_property_reference);
|
|
EXPORT_SYMBOL_GPL(__acpi_node_get_property_reference);
|
|
|
|
|