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/stm32mp2/stm32mp2x.c | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> 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);
>>   }
>>  
> 
> Reviewed-by: Patrick Delaunay <[email protected]>
> 
> Thanks
> Patrick
> 
> 

Applied to u-boot-stm32/master

Thanks
Patrice

Reply via email to