On 2/24/26 13:56, Patrick DELAUNAY wrote:
> Hi,
> 
> On 2/4/26 11:16, Patrice Chotard wrote:
>> 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]>
>> ---
>>   arch/arm/mach-stm32mp/stm32mp1/stm32mp13x.c | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> 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);
>>   }
>>  
> 
> 
> Reviewed-by: Patrick Delaunay <[email protected]>
> 
> Thanks
> Patrick
> 
> 

Applied to u-boot-stm32/master

Thanks
Patrice

Reply via email to