浏览代码

[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>
hipeanut 2 年之前
父节点
当前提交
7882e42c61
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      bsp/raspberry-pi/raspi3-32/cpu/trap.c

+ 6 - 1
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
 #ifdef RT_USING_CPU_FFS
 int __rt_ffs(int value)
 int __rt_ffs(int value)
 {
 {
-    int num = 0;
+    if (!value)
+    {
+        return 0;
+    }
+
+    int num = 1;
 
 
     if ((value & 0xffff) == 0)
     if ((value & 0xffff) == 0)
     {
     {