]> git.hungrycats.org Git - linux/commitdiff
of: return NUMA_NO_NODE from fallback of_node_to_nid()
authorKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
Wed, 8 Apr 2015 16:59:20 +0000 (19:59 +0300)
committerSasha Levin <sasha.levin@oracle.com>
Tue, 4 Aug 2015 18:39:26 +0000 (14:39 -0400)
[ Upstream commit c8fff7bc5bba6bd59cad40441c189c4efe7190f6 ]

Node 0 might be offline as well as any other numa node,
in this case kernel cannot handle memory allocation and crashes.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Fixes: 0c3f061c195c ("of: implement of_node_to_nid as a weak function")
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
drivers/of/base.c
include/linux/of.h

index 4c2ccde42427b864c570dd2b106b9ec35eaf95c5..469d2b7f47eb02df9a3faf22e072fdb6afd8ed2e 100644 (file)
@@ -88,7 +88,7 @@ EXPORT_SYMBOL(of_n_size_cells);
 #ifdef CONFIG_NUMA
 int __weak of_node_to_nid(struct device_node *np)
 {
-       return numa_node_id();
+       return NUMA_NO_NODE;
 }
 #endif
 
index ce9f6a2b3532f4a8e16ec462d0145449ec9a655b..4a6a489a75063ee734d7c69329d04e176cf49286 100644 (file)
@@ -593,7 +593,10 @@ static inline const char *of_prop_next_string(struct property *prop,
 #if defined(CONFIG_OF) && defined(CONFIG_NUMA)
 extern int of_node_to_nid(struct device_node *np);
 #else
-static inline int of_node_to_nid(struct device_node *device) { return 0; }
+static inline int of_node_to_nid(struct device_node *device)
+{
+       return NUMA_NO_NODE;
+}
 #endif
 
 static inline struct device_node *of_find_matching_node(