summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2015-11-30 18:11:29 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-12-07 04:29:22 +0300
commite3f9e299bf94298ddd8beb63c0786a4d7766dc86 (patch)
tree0e4e0fc694b480ca9032910c378d2e8bf13e6512
parent527e9316f8ec44bd53d90fb9f611fa7ffff52bb9 (diff)
downloadlinux-e3f9e299bf94298ddd8beb63c0786a4d7766dc86.tar.xz
device property: always check for fwnode type
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 4fa7508e9f1c (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>
-rw-r--r--drivers/base/property.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/base/property.c b/drivers/base/property.c
index 1325ff225cc4..09e488db59ea 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -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);
@@ -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);