summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorPatrice Chotard <[email protected]>2026-02-04 11:16:07 +0100
committerPatrice Chotard <[email protected]>2026-02-24 17:44:09 +0100
commitab965d31a26610a5ede267f1962956c9deb9e913 (patch)
tree50c3bf5ac788f91dddecfef0e3475d9dab276832 /arch
parent4aac418854a3d865759bfac9110a662e4668bb1c (diff)
stm32mp2: Add check on syscon_get_first_range() return value
syscon_get_first_range()'s return value is used as base address to perform a read, without any checks. In case stmp32mp_syscon is not binded, syscon_get_first_range() returns -ENODEV which leads to a "Synchronous abort". Add syscon_get_first_range() check on return value. Signed-off-by: Patrice Chotard <[email protected]> Reviewed-by: Patrick Delaunay <[email protected]>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-stm32mp/stm32mp2/stm32mp2x.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/arm/mach-stm32mp/stm32mp2/stm32mp2x.c b/arch/arm/mach-stm32mp/stm32mp2/stm32mp2x.c
index 551601a12a9..40fceac402c 100644
--- a/arch/arm/mach-stm32mp/stm32mp2/stm32mp2x.c
+++ b/arch/arm/mach-stm32mp/stm32mp2/stm32mp2x.c
@@ -9,6 +9,7 @@
#include <syscon.h>
#include <asm/io.h>
#include <asm/arch/sys_proto.h>
+#include <linux/err.h>
/* SYSCFG register */
#define SYSCFG_DEVICEID_OFFSET 0x6400
@@ -30,6 +31,12 @@ static u32 read_deviceid(void)
{
void *syscfg = syscon_get_first_range(STM32MP_SYSCON_SYSCFG);
+ if (IS_ERR(syscfg)) {
+ pr_err("Error, can't get SYSCON range (%ld)\n", PTR_ERR(syscfg));
+
+ return PTR_ERR(syscfg);
+ }
+
return readl(syscfg + SYSCFG_DEVICEID_OFFSET);
}