All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/3] device property: check fwnode type in to_of_node()
@ 2015-08-10 16:56 Andy Shevchenko
  2015-08-10 16:56 ` [PATCH v1 2/3] device property: fallback to pset when gettng one string Andy Shevchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Andy Shevchenko @ 2015-08-10 16:56 UTC (permalink / raw)
  To: Rafael J . Wysocki, Greg Kroah-Hartman, linux-kernel; +Cc: Andy Shevchenko

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>
---
 include/linux/of.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/of.h b/include/linux/of.h
index edc068d..2194b8c 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)
 
 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)
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-08-25 23:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-10 16:56 [PATCH v1 1/3] device property: check fwnode type in to_of_node() Andy Shevchenko
2015-08-10 16:56 ` [PATCH v1 2/3] device property: fallback to pset when gettng one string Andy Shevchenko
2015-08-12 11:48   ` Mika Westerberg
2015-08-10 16:56 ` [PATCH v1 3/3] device property: attach 'else if' to the proper 'if' Andy Shevchenko
2015-08-10 17:05   ` Andy Shevchenko
2015-08-12 11:52   ` Mika Westerberg
2015-08-12 11:47 ` [PATCH v1 1/3] device property: check fwnode type in to_of_node() Mika Westerberg
2015-08-26  0:17 ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.