All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] board: anbernic: rgxx3: Correct setting board_type
@ 2026-12-03 14:51 Chris Morgan
  0 siblings, 0 replies; only message in thread
From: Chris Morgan @ 2026-12-03 14:51 UTC (permalink / raw)
  To: u-boot; +Cc: kever.yang, trini, u-boot, jonas, Chris Morgan

From: Chris Morgan <macromorgan@hotmail.com>

The array of rg3xx_model_details starts at 1, but the iterator in
set_gd_value started at 0. While wrong, this did not start causing an
issue until upstream Arm Trusted Firmware started setting the DDR
firewall correctly, causing the board to boot-loop at this step.

Additionally, add a few guards in the set_gd_value() function to return
an error if we don't have an fdt_blob or if we can't get the model id.

Fixes: 7344fa41a2e3 ("board: rockchip: Convert Anbernic RGxx3 to OF_UPSTREAM")
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
 board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
index d402374e90e..370854e7dd6 100644
--- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
+++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
@@ -501,9 +501,14 @@ int set_gd_value(void)
 {
 	const char *model;
 
+	if (!gd->fdt_blob)
+		return -ENODEV;
+
 	model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
+	if (!model)
+		return -ENODEV;
 
-	for (int i = 0; i < ARRAY_SIZE(rg3xx_model_details); i++) {
+	for (int i = 1; i < ARRAY_SIZE(rg3xx_model_details); i++) {
 		if (strcmp(rg3xx_model_details[i].board_name, model) == 0) {
 			gd->board_type = i;
 			if (!rg3xx_model_details[i].uart_con)
-- 
2.53.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-03 14:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 14:51 [PATCH] board: anbernic: rgxx3: Correct setting board_type Chris Morgan

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.