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 <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
#include <dm/device.h>
#include <dm/uclass.h>
#include <linux/bitfield.h>
+#include <linux/err.h>
#include <malloc.h>
/* RCC register */
{
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);
}