Skip to content

Commit

Permalink
device property: always check for fwnode type
Browse files Browse the repository at this point in the history
Currently the property accessors unconditionally fall back to built-in property
set as a last resort. Make this strict and return an error in case the type of
fwnode is unknown.

This is actually a follow up to the commit 4fa7508 (device property:
Return -ENXIO if there is no suitable FW interface).

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 527e931 commit e3f9e29
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions drivers/base/property.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname)
return of_property_read_bool(to_of_node(fwnode), propname);
else if (is_acpi_node(fwnode))
return !acpi_node_prop_get(fwnode, propname, NULL);

return !!pset_prop_get(to_pset(fwnode), propname);
else if (is_pset(fwnode))
return !!pset_prop_get(to_pset(fwnode), propname);
return false;
}
EXPORT_SYMBOL_GPL(fwnode_property_present);

Expand Down Expand Up @@ -494,9 +495,10 @@ int fwnode_property_read_string(struct fwnode_handle *fwnode,
else if (is_acpi_node(fwnode))
return acpi_node_prop_read(fwnode, propname, DEV_PROP_STRING,
val, 1);

return pset_prop_read_array(to_pset(fwnode), propname,
DEV_PROP_STRING, val, 1);
else if (is_pset(fwnode))
return pset_prop_read_array(to_pset(fwnode), propname,
DEV_PROP_STRING, val, 1);
return -ENXIO;
}
EXPORT_SYMBOL_GPL(fwnode_property_read_string);

Expand Down

0 comments on commit e3f9e29

Please sign in to comment.