All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] powerpc/boot: Fix simpleboot CPU node lookup check
@ 2026-07-02 21:15 Thorsten Blum
  2026-07-02 21:15 ` [PATCH 2/3] powerpc/boot: Fix treeboot-currituck " Thorsten Blum
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Thorsten Blum @ 2026-07-02 21:15 UTC (permalink / raw)
  To: Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy (CS GROUP), Josh Boyer, Grant Likely,
	Tony Breeds, Alistair Popple, Benjamin Herrenschmidt
  Cc: linuxppc-dev, linux-kernel, Thorsten Blum

fdt_node_offset_by_prop_value() returns a negative error code on
failure - fix the check accordingly.

Fixes: d2477b5cc8ca ("[POWERPC] bootwrapper: Add a firmware-independent simpleboot target.")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/powerpc/boot/simpleboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/boot/simpleboot.c b/arch/powerpc/boot/simpleboot.c
index c80691d83880..27591df41e9e 100644
--- a/arch/powerpc/boot/simpleboot.c
+++ b/arch/powerpc/boot/simpleboot.c
@@ -68,7 +68,7 @@ void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
 	/* finally, setup the timebase */
 	node = fdt_node_offset_by_prop_value(_dtb_start, -1, "device_type",
 					     "cpu", sizeof("cpu"));
-	if (!node)
+	if (node < 0)
 		fatal("Cannot find cpu node\n");
 	timebase = fdt_getprop(_dtb_start, node, "timebase-frequency", &size);
 	if (timebase && (size == 4))


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

* [PATCH 2/3] powerpc/boot: Fix treeboot-currituck CPU node lookup check
  2026-07-02 21:15 [PATCH 1/3] powerpc/boot: Fix simpleboot CPU node lookup check Thorsten Blum
@ 2026-07-02 21:15 ` Thorsten Blum
  2026-07-09  6:52   ` Ritesh Harjani
  2026-07-02 21:15 ` [PATCH 3/3] powerpc/boot: Fix treeboot-akebono " Thorsten Blum
  2026-07-09  6:26 ` [PATCH 1/3] powerpc/boot: Fix simpleboot " Ritesh Harjani
  2 siblings, 1 reply; 6+ messages in thread
From: Thorsten Blum @ 2026-07-02 21:15 UTC (permalink / raw)
  To: Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy (CS GROUP), Josh Boyer, Grant Likely,
	Tony Breeds, Alistair Popple, Benjamin Herrenschmidt
  Cc: linuxppc-dev, linux-kernel, Thorsten Blum

fdt_node_offset_by_prop_value() returns a negative error code on
failure - fix the check accordingly.

Fixes: 228d55053397 ("powerpc/47x: Add support for the new IBM currituck platform")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/powerpc/boot/treeboot-currituck.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/boot/treeboot-currituck.c b/arch/powerpc/boot/treeboot-currituck.c
index d53e8a592f81..5b5363b74f9f 100644
--- a/arch/powerpc/boot/treeboot-currituck.c
+++ b/arch/powerpc/boot/treeboot-currituck.c
@@ -102,7 +102,7 @@ void platform_init(void)
 
 	node = fdt_node_offset_by_prop_value(_dtb_start, -1, "device_type",
 	                                     "cpu", sizeof("cpu"));
-	if (!node)
+	if (node < 0)
 		fatal("Cannot find cpu node\n");
 	timebase = fdt_getprop(_dtb_start, node, "timebase-frequency", &size);
 	if (timebase && (size == 4))


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

* [PATCH 3/3] powerpc/boot: Fix treeboot-akebono CPU node lookup check
  2026-07-02 21:15 [PATCH 1/3] powerpc/boot: Fix simpleboot CPU node lookup check Thorsten Blum
  2026-07-02 21:15 ` [PATCH 2/3] powerpc/boot: Fix treeboot-currituck " Thorsten Blum
@ 2026-07-02 21:15 ` Thorsten Blum
  2026-07-09  6:52   ` Ritesh Harjani
  2026-07-09  6:26 ` [PATCH 1/3] powerpc/boot: Fix simpleboot " Ritesh Harjani
  2 siblings, 1 reply; 6+ messages in thread
From: Thorsten Blum @ 2026-07-02 21:15 UTC (permalink / raw)
  To: Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy (CS GROUP), Josh Boyer, Grant Likely,
	Tony Breeds, Alistair Popple, Benjamin Herrenschmidt
  Cc: linuxppc-dev, linux-kernel, Thorsten Blum

fdt_node_offset_by_prop_value() returns a negative error code on
failure - fix the check accordingly.

Fixes: 2a2c74b2efcb ("IBM Akebono: Add the Akebono platform")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/powerpc/boot/treeboot-akebono.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/boot/treeboot-akebono.c b/arch/powerpc/boot/treeboot-akebono.c
index e3cc2599869c..1b529037480f 100644
--- a/arch/powerpc/boot/treeboot-akebono.c
+++ b/arch/powerpc/boot/treeboot-akebono.c
@@ -146,7 +146,7 @@ void platform_init(char *userdata)
 
 	node = fdt_node_offset_by_prop_value(_dtb_start, -1, "device_type",
 					     "cpu", sizeof("cpu"));
-	if (!node)
+	if (node < 0)
 		fatal("Cannot find cpu node\n");
 	timebase = fdt_getprop(_dtb_start, node, "timebase-frequency", &size);
 	if (timebase && (size == 4))


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

* Re: [PATCH 1/3] powerpc/boot: Fix simpleboot CPU node lookup check
  2026-07-02 21:15 [PATCH 1/3] powerpc/boot: Fix simpleboot CPU node lookup check Thorsten Blum
  2026-07-02 21:15 ` [PATCH 2/3] powerpc/boot: Fix treeboot-currituck " Thorsten Blum
  2026-07-02 21:15 ` [PATCH 3/3] powerpc/boot: Fix treeboot-akebono " Thorsten Blum
@ 2026-07-09  6:26 ` Ritesh Harjani
  2 siblings, 0 replies; 6+ messages in thread
From: Ritesh Harjani @ 2026-07-09  6:26 UTC (permalink / raw)
  To: Thorsten Blum, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy (CS GROUP), Josh Boyer,
	Grant Likely, Tony Breeds, Alistair Popple,
	Benjamin Herrenschmidt
  Cc: linuxppc-dev, linux-kernel, Thorsten Blum

Thorsten Blum <thorsten.blum@linux.dev> writes:

> fdt_node_offset_by_prop_value() returns a negative error code on
> failure - fix the check accordingly.
>
> Fixes: d2477b5cc8ca ("[POWERPC] bootwrapper: Add a firmware-independent simpleboot target.")
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

yup, if it cannot find the node, then it should return a negative error
code, since cpu node is never the root node. The same thing was anyway
properly done for memory device node in the same function few lines
before...

	/* Find the memory range */
	node = fdt_node_offset_by_prop_value(_dtb_start, -1, "device_type",
					     "memory", sizeof("memory"));
	if (node < 0)
		fatal("Cannot find memory node\n");

...but for cpu node, it uses a wrong comparison check.

Looks good to me. Please feel free to add:
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>

> ---
>  arch/powerpc/boot/simpleboot.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/boot/simpleboot.c b/arch/powerpc/boot/simpleboot.c
> index c80691d83880..27591df41e9e 100644
> --- a/arch/powerpc/boot/simpleboot.c
> +++ b/arch/powerpc/boot/simpleboot.c
> @@ -68,7 +68,7 @@ void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
>  	/* finally, setup the timebase */
>  	node = fdt_node_offset_by_prop_value(_dtb_start, -1, "device_type",
>  					     "cpu", sizeof("cpu"));
> -	if (!node)
> +	if (node < 0)
>  		fatal("Cannot find cpu node\n");
>  	timebase = fdt_getprop(_dtb_start, node, "timebase-frequency", &size);
>  	if (timebase && (size == 4))

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

* Re: [PATCH 2/3] powerpc/boot: Fix treeboot-currituck CPU node lookup check
  2026-07-02 21:15 ` [PATCH 2/3] powerpc/boot: Fix treeboot-currituck " Thorsten Blum
@ 2026-07-09  6:52   ` Ritesh Harjani
  0 siblings, 0 replies; 6+ messages in thread
From: Ritesh Harjani @ 2026-07-09  6:52 UTC (permalink / raw)
  To: Thorsten Blum, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy (CS GROUP), Josh Boyer,
	Grant Likely, Tony Breeds, Alistair Popple,
	Benjamin Herrenschmidt
  Cc: linuxppc-dev, linux-kernel, Thorsten Blum

Thorsten Blum <thorsten.blum@linux.dev> writes:

> fdt_node_offset_by_prop_value() returns a negative error code on
> failure - fix the check accordingly.
>
> Fixes: 228d55053397 ("powerpc/47x: Add support for the new IBM currituck platform")
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

Looks good to me. Please feel free to add:
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>


> ---
>  arch/powerpc/boot/treeboot-currituck.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/boot/treeboot-currituck.c b/arch/powerpc/boot/treeboot-currituck.c
> index d53e8a592f81..5b5363b74f9f 100644
> --- a/arch/powerpc/boot/treeboot-currituck.c
> +++ b/arch/powerpc/boot/treeboot-currituck.c
> @@ -102,7 +102,7 @@ void platform_init(void)
>  
>  	node = fdt_node_offset_by_prop_value(_dtb_start, -1, "device_type",
>  	                                     "cpu", sizeof("cpu"));
> -	if (!node)
> +	if (node < 0)
>  		fatal("Cannot find cpu node\n");
>  	timebase = fdt_getprop(_dtb_start, node, "timebase-frequency", &size);
>  	if (timebase && (size == 4))


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

* Re: [PATCH 3/3] powerpc/boot: Fix treeboot-akebono CPU node lookup check
  2026-07-02 21:15 ` [PATCH 3/3] powerpc/boot: Fix treeboot-akebono " Thorsten Blum
@ 2026-07-09  6:52   ` Ritesh Harjani
  0 siblings, 0 replies; 6+ messages in thread
From: Ritesh Harjani @ 2026-07-09  6:52 UTC (permalink / raw)
  To: Thorsten Blum, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy (CS GROUP), Josh Boyer,
	Grant Likely, Tony Breeds, Alistair Popple,
	Benjamin Herrenschmidt
  Cc: linuxppc-dev, linux-kernel, Thorsten Blum

Thorsten Blum <thorsten.blum@linux.dev> writes:

> fdt_node_offset_by_prop_value() returns a negative error code on
> failure - fix the check accordingly.
>
> Fixes: 2a2c74b2efcb ("IBM Akebono: Add the Akebono platform")
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

Looks good to me. Please feel free to add:
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>

> ---
>  arch/powerpc/boot/treeboot-akebono.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/boot/treeboot-akebono.c b/arch/powerpc/boot/treeboot-akebono.c
> index e3cc2599869c..1b529037480f 100644
> --- a/arch/powerpc/boot/treeboot-akebono.c
> +++ b/arch/powerpc/boot/treeboot-akebono.c
> @@ -146,7 +146,7 @@ void platform_init(char *userdata)
>  
>  	node = fdt_node_offset_by_prop_value(_dtb_start, -1, "device_type",
>  					     "cpu", sizeof("cpu"));
> -	if (!node)
> +	if (node < 0)
>  		fatal("Cannot find cpu node\n");
>  	timebase = fdt_getprop(_dtb_start, node, "timebase-frequency", &size);
>  	if (timebase && (size == 4))


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

end of thread, other threads:[~2026-07-09  6:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-02 21:15 [PATCH 1/3] powerpc/boot: Fix simpleboot CPU node lookup check Thorsten Blum
2026-07-02 21:15 ` [PATCH 2/3] powerpc/boot: Fix treeboot-currituck " Thorsten Blum
2026-07-09  6:52   ` Ritesh Harjani
2026-07-02 21:15 ` [PATCH 3/3] powerpc/boot: Fix treeboot-akebono " Thorsten Blum
2026-07-09  6:52   ` Ritesh Harjani
2026-07-09  6:26 ` [PATCH 1/3] powerpc/boot: Fix simpleboot " Ritesh Harjani

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.