irq_procfs: fix divide 0 error

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2022-06-22 22:38:19 +08:00 committed by Xiang Xiao
parent df365008b2
commit 3bc2131918
1 changed files with 1 additions and 0 deletions

View File

@ -206,6 +206,7 @@ static int irq_callback(int irq, FAR struct irq_info_s *info,
* rate = <interrupt-count> * TICKS_PER_SEC / elapsed * rate = <interrupt-count> * TICKS_PER_SEC / elapsed
*/ */
elapsed = elapsed ? elapsed : 1;
intpart = (unsigned int)((copy.count * TICK_PER_SEC) / elapsed); intpart = (unsigned int)((copy.count * TICK_PER_SEC) / elapsed);
if (intpart >= 10000) if (intpart >= 10000)
{ {