Commit 4bf01181 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Rafael J. Wysocki

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 7dc59dc9
...@@ -136,7 +136,8 @@ static inline bool is_of_node(struct fwnode_handle *fwnode) ...@@ -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) 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) static inline bool of_have_populated_dt(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment