aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2015-08-10 12:56:46 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-08-25 19:46:39 -0400
commit4bf011815f2e093c7f60004f4f5683cf40b905b9 (patch)
tree5195f134c30f92f343baa053c533d4a2429b99bb
parent7dc59dc938f034c69dcf9080d45b936882b7ffa3 (diff)
device property: check fwnode type in to_of_node()
Potentially one of platform can support both ACPI and OF. In that case when we call to_of_node() for non-OF fwnode types we will get non-NULL result, which is wrong. Check for the type and return a correspondent result. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--include/linux/of.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index edc068d19c79..2194b8ca41f9 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -136,7 +136,8 @@ static inline bool is_of_node(struct fwnode_handle *fwnode)
136 136
137static inline struct device_node *to_of_node(struct fwnode_handle *fwnode) 137static inline struct device_node *to_of_node(struct fwnode_handle *fwnode)
138{ 138{
139 return fwnode ? container_of(fwnode, struct device_node, fwnode) : NULL; 139 return is_of_node(fwnode) ?
140 container_of(fwnode, struct device_node, fwnode) : NULL;
140} 141}
141 142
142static inline bool of_have_populated_dt(void) 143static inline bool of_have_populated_dt(void)