[PATCH 8/9] ARM: boards: protonic-rk356x: Fix crash with different boards
Robin van der Gracht
robin.van.der.gracht at protonic.nl
Wed Mar 4 03:00:12 PST 2026
From: David Jander <david at 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 at protonic.nl>
Tested-by: Robin van der Gracht <robin.van.der.gracht at 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
More information about the barebox
mailing list