From 7882e42c614c24a1750cba4a3e2936b6bf68f42f Mon Sep 17 00:00:00 2001 From: hipeanut <109409810+hipeanut@users.noreply.github.com> Date: Tue, 2 Aug 2022 11:18:17 +0800 Subject: [PATCH] [bsp/raspi3-32] fix some bug of funtion '__rt_ffs' (#6187) * [bsp/raspi3-32] fix some bug of funtion '__rt_ffs' * Update trap.c Co-authored-by: Man, Jianting (Meco) <920369182@qq.com> --- bsp/raspberry-pi/raspi3-32/cpu/trap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) mode change 100644 => 100755 bsp/raspberry-pi/raspi3-32/cpu/trap.c diff --git a/bsp/raspberry-pi/raspi3-32/cpu/trap.c b/bsp/raspberry-pi/raspi3-32/cpu/trap.c old mode 100644 new mode 100755 index c4d0d08e1a..26893e2a49 --- a/bsp/raspberry-pi/raspi3-32/cpu/trap.c +++ b/bsp/raspberry-pi/raspi3-32/cpu/trap.c @@ -133,7 +133,12 @@ void rt_hw_trap_resv(struct rt_hw_exp_stack *regs) #ifdef RT_USING_CPU_FFS int __rt_ffs(int value) { - int num = 0; + if (!value) + { + return 0; + } + + int num = 1; if ((value & 0xffff) == 0) {