[PATCH 11/18] dbtr: Succeed operations with no triggers in mask

Nicholas Piggin
2026-03-13T05:21:04Z

Trigger operations that use bitmasks should succeed if there are no
triggers in the mask.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
lib/sbi/sbi_dbtr.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/lib/sbi/sbi_dbtr.c b/lib/sbi/sbi_dbtr.c
index f72c76f2..5735bdc6 100644
--- a/lib/sbi/sbi_dbtr.c
+++ b/lib/sbi/sbi_dbtr.c
@@ -694,6 +694,9 @@ int sbi_dbtr_uninstall_trig(unsigned long trig_idx_base,
if (!hs)
return SBI_ERR_FAILED;

+ if (!trig_idx_mask)
+ return SBI_SUCCESS;
+
if (trig_idx_base >= hs->total_trigs ||
find_last_bit(&trig_idx_mask, hs->total_trigs) +
trig_idx_base >= hs->total_trigs)
@@ -728,6 +731,9 @@ int sbi_dbtr_enable_trig(unsigned long trig_idx_base,
if (!hs)
return SBI_ERR_FAILED;

+ if (!trig_idx_mask)
+ return SBI_SUCCESS;
+
if (trig_idx_base >= hs->total_trigs ||
find_last_bit(&trig_idx_mask, hs->total_trigs) +
trig_idx_base >= hs->total_trigs)
@@ -844,6 +850,9 @@ int sbi_dbtr_disable_trig(unsigned long trig_idx_base,
if (!hs)
return SBI_ERR_FAILED;

+ if (!trig_idx_mask)
+ return SBI_SUCCESS;
+
if (trig_idx_base >= hs->total_trigs ||
find_last_bit(&trig_idx_mask, hs->total_trigs) +
trig_idx_base >= hs->total_trigs)