diff mbox series

[v3,23/26] of, numa: return -EINVAL when no numa-node-id is found

Message ID 20240801060826.559858-24-rppt@kernel.org (mailing list archive)
State Superseded
Headers show
Series mm: introduce numa_memblks | expand

Checks

Context Check Description
conchuod/vmtest-fixes-PR fail merge-conflict
conchuod/vmtest-for-next-PR success PR summary
conchuod/patch-23-test-1 success .github/scripts/patches/tests/build_rv32_defconfig.sh
conchuod/patch-23-test-2 success .github/scripts/patches/tests/build_rv64_clang_allmodconfig.sh
conchuod/patch-23-test-3 success .github/scripts/patches/tests/build_rv64_gcc_allmodconfig.sh
conchuod/patch-23-test-4 success .github/scripts/patches/tests/build_rv64_nommu_k210_defconfig.sh
conchuod/patch-23-test-5 success .github/scripts/patches/tests/build_rv64_nommu_virt_defconfig.sh
conchuod/patch-23-test-6 success .github/scripts/patches/tests/checkpatch.sh
conchuod/patch-23-test-7 success .github/scripts/patches/tests/dtb_warn_rv64.sh
conchuod/patch-23-test-8 success .github/scripts/patches/tests/header_inline.sh
conchuod/patch-23-test-9 success .github/scripts/patches/tests/kdoc.sh
conchuod/patch-23-test-10 success .github/scripts/patches/tests/module_param.sh
conchuod/patch-23-test-11 success .github/scripts/patches/tests/verify_fixes.sh
conchuod/patch-23-test-12 success .github/scripts/patches/tests/verify_signedoff.sh

Commit Message

Mike Rapoport Aug. 1, 2024, 6:08 a.m. UTC
From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>

Currently of_numa_parse_memory_nodes() returns 0 if no "memory" node in
device tree contains "numa-node-id" property. This makes of_numa_init()
to return "success" despite no NUMA nodes were actually parsed and set
up.

arch_numa workarounds this by returning an error if numa_nodes_parsed is
empty.

numa_memblks however would WARN() in such case and since it will be used
by arch_numa shortly, such warning is not desirable.

Make sure of_numa_init() returns -EINVAL when no NUMA node information
was found in the device tree.

Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
 drivers/of/of_numa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jonathan Cameron Aug. 2, 2024, 2:01 p.m. UTC | #1
On Thu,  1 Aug 2024 09:08:23 +0300
Mike Rapoport <rppt@kernel.org> wrote:

> From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
> 
> Currently of_numa_parse_memory_nodes() returns 0 if no "memory" node in
> device tree contains "numa-node-id" property. This makes of_numa_init()
> to return "success" despite no NUMA nodes were actually parsed and set
> up.
> 
> arch_numa workarounds this by returning an error if numa_nodes_parsed is
> empty.
> 
> numa_memblks however would WARN() in such case and since it will be used
> by arch_numa shortly, such warning is not desirable.
> 
> Make sure of_numa_init() returns -EINVAL when no NUMA node information
> was found in the device tree.
> 
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
David Hildenbrand Aug. 6, 2024, 1:23 p.m. UTC | #2
On 01.08.24 08:08, Mike Rapoport wrote:
> From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
> 
> Currently of_numa_parse_memory_nodes() returns 0 if no "memory" node in
> device tree contains "numa-node-id" property. This makes of_numa_init()
> to return "success" despite no NUMA nodes were actually parsed and set
> up.
> 
> arch_numa workarounds this by returning an error if numa_nodes_parsed is
> empty.
> 
> numa_memblks however would WARN() in such case and since it will be used
> by arch_numa shortly, such warning is not desirable.
> 
> Make sure of_numa_init() returns -EINVAL when no NUMA node information
> was found in the device tree.
> 
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> ---

Acked-by: David Hildenbrand <david@redhat.com>
diff mbox series

Patch

diff --git a/drivers/of/of_numa.c b/drivers/of/of_numa.c
index 838747e319a2..2ec20886d176 100644
--- a/drivers/of/of_numa.c
+++ b/drivers/of/of_numa.c
@@ -45,7 +45,7 @@  static int __init of_numa_parse_memory_nodes(void)
 	struct device_node *np = NULL;
 	struct resource rsrc;
 	u32 nid;
-	int i, r;
+	int i, r = -EINVAL;
 
 	for_each_node_by_type(np, "memory") {
 		r = of_property_read_u32(np, "numa-node-id", &nid);
@@ -72,7 +72,7 @@  static int __init of_numa_parse_memory_nodes(void)
 		}
 	}
 
-	return 0;
+	return r;
 }
 
 static int __init of_numa_parse_distance_map_v1(struct device_node *map)