mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-06 04:33:58 +08:00
ACPI: properties: Fix __acpi_node_get_property_reference() return codes
Fix more return codes for device property: Align return codes of
__acpi_node_get_property_reference().
In particular, what was missed previously:
-EPROTO could be returned in certain cases, now -EINVAL;
-EINVAL was returned if the property was not found, now -ENOENT;
-EINVAL was returned also if the index was higher than the number of
entries in a package, now -ENOENT.
Reported-by: Hyungwoo Yang <hyungwoo.yang@intel.com>
Fixes: 3e3119d308
(device property: Introduce fwnode_property_get_reference_args)
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Hyungwoo Yang <hyungwoo.yang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
c343bc2ce2
commit
51858a2777
@ -593,7 +593,7 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
|
|||||||
|
|
||||||
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
|
||||||
@ -605,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;
|
||||||
@ -621,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)
|
if (obj->type != ACPI_TYPE_PACKAGE)
|
||||||
return -EPROTO;
|
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user