diff mbox series

[1/2] stm32mp1: spl: Fix compilation warnings

Message ID 20240611095239.16026-1-patrice.chotard@foss.st.com
State Accepted
Commit 9c9eeb6e37035f237a24b3e7fca3a38121dd747f
Delegated to: Patrice Chotard
Headers show
Series [1/2] stm32mp1: spl: Fix compilation warnings | expand

Commit Message

Patrice CHOTARD June 11, 2024, 9:52 a.m. UTC
Fix the following compilation warnings :

../arch/arm/mach-stm32mp/stm32mp1/spl.c: In function 'stm32_init_tzc_for_optee':
../arch/arm/mach-stm32mp/stm32mp1/spl.c:148:37: warning: 'optee_size' may be used uninitialized [-Wmaybe-uninitialized]
  148 |         tee_shmem_base = optee_base + optee_size - CFG_SHMEM_SIZE;
      |                          ~~~~~~~~~~~^~~~~~~~~~~~
../arch/arm/mach-stm32mp/stm32mp1/spl.c:137:30: note: 'optee_size' was declared here
  137 |         uint32_t optee_base, optee_size, tee_shmem_base;
      |                              ^~~~~~~~~~
../arch/arm/mach-stm32mp/stm32mp1/spl.c:148:37: warning: 'optee_base' may be used
uninitialized [-Wmaybe-uninitialized]
  148 |         tee_shmem_base = optee_base + optee_size - CFG_SHMEM_SIZE;
      |                          ~~~~~~~~~~~^~~~~~~~~~~~
../arch/arm/mach-stm32mp/stm32mp1/spl.c:137:18: note: 'optee_base' was declared here
  137 |         uint32_t optee_base, optee_size, tee_shmem_base;
      |                  ^~~~~~~~~~

Fix also the following checkpatch "check" :

CHECK: Prefer kernel type 'u32' over 'uint32_t'
37: FILE: arch/arm/mach-stm32mp/stm32mp1/spl.c:137:
+	uint32_t optee_base = 0, optee_size = 0, tee_shmem_base;

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
---

 arch/arm/mach-stm32mp/stm32mp1/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Patrick DELAUNAY June 14, 2024, 7:59 a.m. UTC | #1
Hi Patrice,

On 6/11/24 11:52, Patrice Chotard wrote:
> Fix the following compilation warnings :
>
> ../arch/arm/mach-stm32mp/stm32mp1/spl.c: In function 'stm32_init_tzc_for_optee':
> ../arch/arm/mach-stm32mp/stm32mp1/spl.c:148:37: warning: 'optee_size' may be used uninitialized [-Wmaybe-uninitialized]
>    148 |         tee_shmem_base = optee_base + optee_size - CFG_SHMEM_SIZE;
>        |                          ~~~~~~~~~~~^~~~~~~~~~~~
> ../arch/arm/mach-stm32mp/stm32mp1/spl.c:137:30: note: 'optee_size' was declared here
>    137 |         uint32_t optee_base, optee_size, tee_shmem_base;
>        |                              ^~~~~~~~~~
> ../arch/arm/mach-stm32mp/stm32mp1/spl.c:148:37: warning: 'optee_base' may be used
> uninitialized [-Wmaybe-uninitialized]
>    148 |         tee_shmem_base = optee_base + optee_size - CFG_SHMEM_SIZE;
>        |                          ~~~~~~~~~~~^~~~~~~~~~~~
> ../arch/arm/mach-stm32mp/stm32mp1/spl.c:137:18: note: 'optee_base' was declared here
>    137 |         uint32_t optee_base, optee_size, tee_shmem_base;
>        |                  ^~~~~~~~~~
>
> Fix also the following checkpatch "check" :
>
> CHECK: Prefer kernel type 'u32' over 'uint32_t'
> 37: FILE: arch/arm/mach-stm32mp/stm32mp1/spl.c:137:
> +	uint32_t optee_base = 0, optee_size = 0, tee_shmem_base;
>
> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
> ---
>
>   arch/arm/mach-stm32mp/stm32mp1/spl.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-stm32mp/stm32mp1/spl.c b/arch/arm/mach-stm32mp/stm32mp1/spl.c
> index 6c79259b2c8..10abbed87f0 100644
> --- a/arch/arm/mach-stm32mp/stm32mp1/spl.c
> +++ b/arch/arm/mach-stm32mp/stm32mp1/spl.c
> @@ -134,7 +134,7 @@ void stm32_init_tzc_for_optee(void)
>   {
>   	const uint32_t dram_size = stm32mp_get_dram_size();
>   	const uintptr_t dram_top = STM32_DDR_BASE + (dram_size - 1);
> -	uint32_t optee_base, optee_size, tee_shmem_base;
> +	u32 optee_base = 0, optee_size = 0, tee_shmem_base;
>   	const uintptr_t tzc = STM32_TZC_BASE;
>   	int ret;
>   

Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

Thanks
Patrick
Patrice CHOTARD June 14, 2024, 9:33 a.m. UTC | #2
On 6/14/24 09:59, Patrick DELAUNAY wrote:
> Hi Patrice,
> 
> On 6/11/24 11:52, Patrice Chotard wrote:
>> Fix the following compilation warnings :
>>
>> ../arch/arm/mach-stm32mp/stm32mp1/spl.c: In function 'stm32_init_tzc_for_optee':
>> ../arch/arm/mach-stm32mp/stm32mp1/spl.c:148:37: warning: 'optee_size' may be used uninitialized [-Wmaybe-uninitialized]
>>    148 |         tee_shmem_base = optee_base + optee_size - CFG_SHMEM_SIZE;
>>        |                          ~~~~~~~~~~~^~~~~~~~~~~~
>> ../arch/arm/mach-stm32mp/stm32mp1/spl.c:137:30: note: 'optee_size' was declared here
>>    137 |         uint32_t optee_base, optee_size, tee_shmem_base;
>>        |                              ^~~~~~~~~~
>> ../arch/arm/mach-stm32mp/stm32mp1/spl.c:148:37: warning: 'optee_base' may be used
>> uninitialized [-Wmaybe-uninitialized]
>>    148 |         tee_shmem_base = optee_base + optee_size - CFG_SHMEM_SIZE;
>>        |                          ~~~~~~~~~~~^~~~~~~~~~~~
>> ../arch/arm/mach-stm32mp/stm32mp1/spl.c:137:18: note: 'optee_base' was declared here
>>    137 |         uint32_t optee_base, optee_size, tee_shmem_base;
>>        |                  ^~~~~~~~~~
>>
>> Fix also the following checkpatch "check" :
>>
>> CHECK: Prefer kernel type 'u32' over 'uint32_t'
>> 37: FILE: arch/arm/mach-stm32mp/stm32mp1/spl.c:137:
>> +    uint32_t optee_base = 0, optee_size = 0, tee_shmem_base;
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
>> ---
>>
>>   arch/arm/mach-stm32mp/stm32mp1/spl.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/mach-stm32mp/stm32mp1/spl.c b/arch/arm/mach-stm32mp/stm32mp1/spl.c
>> index 6c79259b2c8..10abbed87f0 100644
>> --- a/arch/arm/mach-stm32mp/stm32mp1/spl.c
>> +++ b/arch/arm/mach-stm32mp/stm32mp1/spl.c
>> @@ -134,7 +134,7 @@ void stm32_init_tzc_for_optee(void)
>>   {
>>       const uint32_t dram_size = stm32mp_get_dram_size();
>>       const uintptr_t dram_top = STM32_DDR_BASE + (dram_size - 1);
>> -    uint32_t optee_base, optee_size, tee_shmem_base;
>> +    u32 optee_base = 0, optee_size = 0, tee_shmem_base;
>>       const uintptr_t tzc = STM32_TZC_BASE;
>>       int ret;
>>   
> 
> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> 
> Thanks
> Patrick
> 
> 
Applied to u-boot-stm32/master

Thanks
Patrice
diff mbox series

Patch

diff --git a/arch/arm/mach-stm32mp/stm32mp1/spl.c b/arch/arm/mach-stm32mp/stm32mp1/spl.c
index 6c79259b2c8..10abbed87f0 100644
--- a/arch/arm/mach-stm32mp/stm32mp1/spl.c
+++ b/arch/arm/mach-stm32mp/stm32mp1/spl.c
@@ -134,7 +134,7 @@  void stm32_init_tzc_for_optee(void)
 {
 	const uint32_t dram_size = stm32mp_get_dram_size();
 	const uintptr_t dram_top = STM32_DDR_BASE + (dram_size - 1);
-	uint32_t optee_base, optee_size, tee_shmem_base;
+	u32 optee_base = 0, optee_size = 0, tee_shmem_base;
 	const uintptr_t tzc = STM32_TZC_BASE;
 	int ret;