forked from luck/tmp_suning_uos_patched
Merge branch 'device-properties'
* device-properties: device property: check fwnode type in to_of_node() device property: attach 'else if' to the proper 'if' device property: fallback to pset when gettng one string device property: fix potential NULL pointer dereference
This commit is contained in:
commit
498012511a
@ -528,13 +528,14 @@ int acpi_dev_prop_read(struct acpi_device *adev, const char *propname,
|
||||
|
||||
if (!val)
|
||||
return obj->package.count;
|
||||
else if (nval <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (nval > obj->package.count)
|
||||
return -EOVERFLOW;
|
||||
else if (nval <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
items = obj->package.elements;
|
||||
|
||||
switch (proptype) {
|
||||
case DEV_PROP_U8:
|
||||
ret = acpi_copy_property_array_u8(items, (u8 *)val, nval);
|
||||
|
@ -27,9 +27,10 @@
|
||||
*/
|
||||
void device_add_property_set(struct device *dev, struct property_set *pset)
|
||||
{
|
||||
if (pset)
|
||||
pset->fwnode.type = FWNODE_PDATA;
|
||||
if (!pset)
|
||||
return;
|
||||
|
||||
pset->fwnode.type = FWNODE_PDATA;
|
||||
set_secondary_fwnode(dev, &pset->fwnode);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(device_add_property_set);
|
||||
@ -461,7 +462,8 @@ int fwnode_property_read_string(struct fwnode_handle *fwnode,
|
||||
return acpi_dev_prop_read(to_acpi_node(fwnode), propname,
|
||||
DEV_PROP_STRING, val, 1);
|
||||
|
||||
return -ENXIO;
|
||||
return pset_prop_read_array(to_pset(fwnode), propname,
|
||||
DEV_PROP_STRING, val, 1);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(fwnode_property_read_string);
|
||||
|
||||
|
@ -136,7 +136,8 @@ static inline bool is_of_node(struct fwnode_handle *fwnode)
|
||||
|
||||
static inline struct device_node *to_of_node(struct fwnode_handle *fwnode)
|
||||
{
|
||||
return fwnode ? container_of(fwnode, struct device_node, fwnode) : NULL;
|
||||
return is_of_node(fwnode) ?
|
||||
container_of(fwnode, struct device_node, fwnode) : NULL;
|
||||
}
|
||||
|
||||
static inline bool of_have_populated_dt(void)
|
||||
|
Loading…
Reference in New Issue
Block a user