Skip to content

Commit 2dfbae2

Browse files
unicornxmysterywolf
authored andcommitted
libcpu: riscv: common: fixed build warnings
When building bsp/cvitek/c906_little, compiler warns: ``` .../rt-thread/libcpu/risc-v/common/trap_common.c: In function 'rt_hw_interrupt_install': .../rt-thread/libcpu/risc-v/common/trap_common.c:50:11: warning: unused variable 'user_param' [-Wunused-variable] 50 | void *user_param = param; | ^~~~~~~~~~ .../rt-thread/libcpu/risc-v/common/trap_common.c: In function 'rt_rv32_system_irq_handler': .../rt-thread/libcpu/risc-v/common/trap_common.c:77:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 77 | s_stack_frame = (rt_hw_stack_frame_t *)mscratch; | ^ ``` Fixed these warnings as per indication from gcc. Signed-off-by: Chen Wang <[email protected]>
1 parent 3383352 commit 2dfbae2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

libcpu/risc-v/common/trap_common.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ rt_weak rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t ha
4747
void *param, const char *name)
4848
{
4949
rt_isr_handler_t old_handler = RT_NULL;
50-
void *user_param = param;
5150

5251
if(vector < ISR_NUMBER)
5352
{
@@ -74,7 +73,7 @@ rt_weak void rt_rv32_system_irq_handler(rt_uint32_t mcause)
7473
rt_uint32_t exception = !(mcause & 0x80000000);
7574
if(exception)
7675
{
77-
s_stack_frame = (rt_hw_stack_frame_t *)mscratch;
76+
s_stack_frame = (volatile rt_hw_stack_frame_t *)(uintptr_t)mscratch;
7877
rt_show_stack_frame();
7978
}
8079
else

0 commit comments

Comments
 (0)