mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
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 <patrice.chotard@foss.st.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user