diff options
| author | Himanshu Chauhan <[email protected]> | 2024-01-02 22:16:24 +0530 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2024-02-05 10:23:01 +0530 |
| commit | 1ec353d5046c2f58033f9fdbeb45405f00c270fb (patch) | |
| tree | cdfb2c424a3da2eae6db97dd6a5ccf1342bdf41c | |
| parent | bb90a9ebf6d9a2fe7726978d594e82cdbaad7799 (diff) | |
lib: sbi: Use mask to check the free bit during trigger allocation
The trigger allocation function uses bit shift instead of mask to check the
mapped status of the triggers. This causes index 0 to be return always. As a
result, the older triggers are overwritten.
Use the mask for MAPPED field in state word to check if the trigger is mapped.
Fixes: 97f234f15 ("lib: sbi: Introduce the SBI debug triggers extension support")
Signed-off-by: Himanshu Chauhan <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
| -rw-r--r-- | lib/sbi/sbi_dbtr.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sbi/sbi_dbtr.c b/lib/sbi/sbi_dbtr.c index 019e702c..7142fedb 100644 --- a/lib/sbi/sbi_dbtr.c +++ b/lib/sbi/sbi_dbtr.c @@ -129,7 +129,7 @@ static inline struct sbi_dbtr_trigger *sbi_alloc_trigger(void) for (i = 0; i < hart_state->total_trigs; i++) { f_trig = INDEX_TO_TRIGGER(i); - if (f_trig->state & RV_DBTR_BIT(TS, MAPPED)) + if (f_trig->state & RV_DBTR_BIT_MASK(TS, MAPPED)) continue; hart_state->available_trigs--; break; |
