Skip to content

Commit

Permalink
Prevent underflow for preempt_count_dec()
Browse files Browse the repository at this point in the history
  • Loading branch information
shengwen-tw committed May 20, 2024
1 parent 0396e2d commit 961902b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ inline void preempt_count_inc(void)

inline void preempt_count_dec(void)
{
preempt_cnt--;
if (preempt_cnt > 0)
preempt_cnt--;
}

void preempt_disable(void)
Expand Down

0 comments on commit 961902b

Please sign in to comment.