Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1204434
| Path | csiph.com!goblin3!goblin2!goblin.stu.neva.ru!gothmog.csi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH v1 1/3] device property: check fwnode type in to_of_node() |
| Date | Mon, 10 Aug 2015 19:00:02 +0200 |
| Message-ID | <pVYAx-3Ki-3@gated-at.bofh.it> (permalink) |
| X-Original-To | "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org |
| X-Extloop1 | 1 |
| X-Ironport-Av | E=Sophos;i="5.15,646,1432623600"; d="scan'208";a="745780002" |
| X-Mailer | git-send-email 2.5.0 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 31 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
| X-Original-Date | Mon, 10 Aug 2015 19:56:46 +0300 |
| X-Original-Message-ID | <1439225808-132916-1-git-send-email-andriy.shevchenko@linux.intel.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1204434 |
Show key headers only | View raw
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/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[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
csiph-web