libc/backtrace: Fix compilation error when set LIBC_BACKTRACE_BUFFSIZE

When compiling lib_backtrace.c after set CONFIG_LIBC_BACKTRACE_BUFFSIZE,
there will be compilation error warnings. This is because spin_unlock_irqrestore
incorrectly used pool->lock during unlocking, which has been corrected to bp->lock.

Signed-off-by: Baichuan Rong <rongbaichuan1027@163.com>
This commit is contained in:
rongbaichuan 2025-05-04 18:11:46 +08:00 committed by Xiang Xiao
parent 5d2f121231
commit ee3e2401e7

View File

@ -267,14 +267,14 @@ int backtrace_record(int skip)
entry = &bp->pool[index];
entry->count++;
spin_unlock_irqrestore(&pool->lock, flags);
spin_unlock_irqrestore(&bp->lock, flags);
return index;
}
index = backtrace_alloc(bp);
if (index < 0)
{
spin_unlock_irqrestore(&pool->lock, flags);
spin_unlock_irqrestore(&bp->lock, flags);
return index;
}
@ -289,7 +289,7 @@ int backtrace_record(int skip)
entry->next = bp->bucket[slot];
bp->bucket[slot] = index;
spin_unlock_irqrestore(&pool->lock, flags);
spin_unlock_irqrestore(&bp->lock, flags);
return index;
}
@ -323,7 +323,7 @@ int backtrace_remove(int index)
if (entry->count > 1)
{
entry->count--;
spin_unlock_irqrestore(&pool->lock, flags);
spin_unlock_irqrestore(&bp->lock, flags);
return OK;
}
@ -367,7 +367,7 @@ int backtrace_remove(int index)
}
backtrace_free(bp, index);
spin_unlock_irqrestore(&pool->lock, flags);
spin_unlock_irqrestore(&bp->lock, flags);
return OK;
}