summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrice Chotard <[email protected]>2026-02-04 11:16:08 +0100
committerPatrice Chotard <[email protected]>2026-02-24 17:44:09 +0100
commitac7f28523cd4fc5c01bc4a99e0ed856b32d1cf8d (patch)
treeaae58411ddbefa21119d862238dea31a893ce62e
parentab965d31a26610a5ede267f1962956c9deb9e913 (diff)
stm32mp1: 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]>
-rw-r--r--arch/arm/mach-stm32mp/stm32mp1/stm32mp13x.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/arm/mach-stm32mp/stm32mp1/stm32mp13x.c b/arch/arm/mach-stm32mp/stm32mp1/stm32mp13x.c
index 79b2f2d0bba..6d2d69f3442 100644
--- a/arch/arm/mach-stm32mp/stm32mp1/stm32mp13x.c
+++ b/arch/arm/mach-stm32mp/stm32mp1/stm32mp13x.c
@@ -17,6 +17,7 @@
#include <dm/device.h>
#include <dm/uclass.h>
#include <linux/bitfield.h>
+#include <linux/err.h>
#include <malloc.h>
/* RCC register */
@@ -231,6 +232,12 @@ static u32 read_idc(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_IDC_OFFSET);
}