From: Robin van der Gracht <robin.van.der.gracht@protonic.nl>
To: barebox@lists.infradead.org
Cc: Robin van der Gracht <robin.van.der.gracht@protonic.nl>,
David Jander <david@protonic.nl>
Subject: [PATCH 8/9] ARM: boards: protonic-rk356x: Fix crash with different boards
Date: Wed, 4 Mar 2026 12:00:12 +0100 [thread overview]
Message-ID: <20260304110013.495725-9-robin.van.der.gracht@protonic.nl> (raw)
In-Reply-To: <20260304110013.495725-1-robin.van.der.gracht@protonic.nl>
From: David Jander <david@protonic.nl>
prt_rk356x_devices_init() is an initcall and thus executed even for boards
that are not compatible with this one. This leads to a null-pointer
dereference in prt_priv.model, since this struct is not initialized for
other boards. Add a simple check to avoid this crash.
Signed-off-by: David Jander <david@protonic.nl>
Tested-by: Robin van der Gracht <robin.van.der.gracht@protonic.nl>
---
arch/arm/boards/protonic-rk356x/board.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm/boards/protonic-rk356x/board.c b/arch/arm/boards/protonic-rk356x/board.c
index 5fba0be98a..486c77e441 100644
--- a/arch/arm/boards/protonic-rk356x/board.c
+++ b/arch/arm/boards/protonic-rk356x/board.c
@@ -141,6 +141,9 @@ static int prt_rk356x_devices_init(void)
{
int ret;
+ if (!prt_priv.model)
+ return 0; /* Not a prt_rk356x board! */
+
prt_rk356x_bbu();
if (prt_priv.model->init) {
--
2.43.0
next prev parent reply other threads:[~2026-03-04 11:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 11:00 [PATCH 0/9] ARM: boards: protonic-mecsbc: Generalization Robin van der Gracht
2026-03-04 11:00 ` [PATCH 1/9] ARM: boards: Rename protonic-mecsbc to protonic-rk356x Robin van der Gracht
2026-03-04 11:00 ` [PATCH 2/9] ARM: boards: protonic-rk356x: Remove VIN measurement Robin van der Gracht
2026-03-04 11:00 ` [PATCH 3/9] ARM: boards: protonic-rk356x: Use devicetree alias for saradc Robin van der Gracht
2026-03-04 11:00 ` [PATCH 4/9] ARM: boards: protonic-rk356x: Configure ADC and channels in model data Robin van der Gracht
2026-03-04 11:00 ` [PATCH 5/9] ARM: boards: protonic-rk356x: Move mecsbc code to model init function Robin van der Gracht
2026-03-04 11:00 ` [PATCH 6/9] ARM: boards: protonic-rk356x: Use rockchip_bbu_mmc_register Robin van der Gracht
2026-03-04 11:00 ` [PATCH 7/9] ARM: boards: protonic-rk356x: Move bbu setup to device late init Robin van der Gracht
2026-03-04 11:00 ` Robin van der Gracht [this message]
2026-03-04 11:00 ` [PATCH 9/9] ARM: boards: protonic-rk356x: Read board serial and MAC address from eMMC Robin van der Gracht
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=20260304110013.495725-9-robin.van.der.gracht@protonic.nl \
--to=robin.van.der.gracht@protonic.nl \
--cc=barebox@lists.infradead.org \
--cc=david@protonic.nl \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox