All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Morgan <macroalpha82@gmail.com>
To: u-boot@lists.u-boot-project.org
Cc: kever.yang@rock-chips.com, trini@konsulko.com, u-boot@0leil.net,
	jonas@kwiboo.se, Chris Morgan <macromorgan@hotmail.com>
Subject: [PATCH] board: anbernic: rgxx3: Correct setting board_type
Date: Thu,  3 Dec 2026 08:51:03 -0600	[thread overview]
Message-ID: <20261203145103.509845-1-macroalpha82@gmail.com> (raw)

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


                 reply	other threads:[~2026-12-03 14:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261203145103.509845-1-macroalpha82@gmail.com \
    --to=macroalpha82@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=kever.yang@rock-chips.com \
    --cc=macromorgan@hotmail.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@0leil.net \
    --cc=u-boot@lists.u-boot-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.