Skip to content

Commit

Permalink
[bsp][cvitek] fix c906_little build warning in cache.c
Browse files Browse the repository at this point in the history
build warning: passing argument 1 of 'inv_icache_range' makes integer
from pointer without a cast [-Wint-conversion]

Analyze: The passed parameter type is void*, which is a pointer type,
but the required type is uintptr_t, which is an integer type. Therefore,
there will be a 'makes integer from pointer without a cast' warning.

Solution: casting the void* pointer to uintptr_t, ensure that the
function receives the correct type.

Signed-off-by: zdtyuiop4444 <[email protected]>
  • Loading branch information
zdtyuiop4444 committed Jan 16, 2025
1 parent 6cbb2c3 commit 73c44fb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bsp/cvitek/c906_little/board/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*
* Change Logs:
* Date Author Notes
* 2025/01/16 zdtyuiop4444 fix type cast warning
* 2024/11/26 zdtyuiop4444 The first version
*/

Expand Down Expand Up @@ -33,10 +34,10 @@ inline void rt_hw_cpu_dcache_ops(int ops, void* addr, int size)
switch (ops)
{
case RT_HW_CACHE_FLUSH:
flush_dcache_range(addr, size);
flush_dcache_range((uintptr_t)addr, size);
break;
case RT_HW_CACHE_INVALIDATE:
inv_dcache_range(addr, size);
inv_dcache_range((uintptr_t)addr, size);
break;
default:
break;
Expand All @@ -62,7 +63,7 @@ inline void rt_hw_cpu_icache_ops(int ops, void* addr, int size)
switch (ops)
{
case RT_HW_CACHE_INVALIDATE:
inv_icache_range(addr, size);
inv_icache_range((uintptr_t)addr, size);
break;
default:
break;
Expand Down

0 comments on commit 73c44fb

Please sign in to comment.