Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1204434 > unrolled thread

[PATCH v1 1/3] device property: check fwnode type in to_of_node()

Started byAndy Shevchenko <andriy.shevchenko@linux.intel.com>
First post2015-08-10 19:00 +0200
Last post2015-08-12 13:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v1 1/3] device property: check fwnode type in to_of_node() Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-08-10 19:00 +0200
    Re: [PATCH v1 1/3] device property: check fwnode type in to_of_node() Mika Westerberg <mika.westerberg@linux.intel.com> - 2015-08-12 13:50 +0200

#1204434 — [PATCH v1 1/3] device property: check fwnode type in to_of_node()

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2015-08-10 19:00 +0200
Subject[PATCH v1 1/3] device property: check fwnode type in to_of_node()
Message-ID<pVYAx-3Ki-3@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1205983

FromMika Westerberg <mika.westerberg@linux.intel.com>
Date2015-08-12 13:50 +0200
Message-ID<pWCHE-3ic-21@gated-at.bofh.it>
In reply to#1204434
On Mon, Aug 10, 2015 at 07:56:46PM +0300, Andy Shevchenko wrote:
> 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>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web