[PATCH] sh: intc: Use BUG_ON instead of if condition followed by BUG

From: Xichao Zhao
Date: Mon Aug 11 2025 - 03:06:13 EST


BUG_ON uses unlikely in if(), it can be optimized at compile time.

Usually, the condition in if() is not satisfied. In my opinion,
this can improve the efficiency of the multi-stage pipeline.

Signed-off-by: Xichao Zhao <zhao.xichao@xxxxxxxx>
---
drivers/sh/intc/handle.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/sh/intc/handle.c b/drivers/sh/intc/handle.c
index 7863a44918a2..defa8780b566 100644
--- a/drivers/sh/intc/handle.c
+++ b/drivers/sh/intc/handle.c
@@ -128,8 +128,7 @@ static unsigned int __init _intc_prio_data(struct intc_desc *desc,
} else {
fn = REG_FN_MODIFY_BASE;
mode = MODE_PRIO_REG;
- if (!pr->set_reg)
- BUG();
+ BUG_ON(!pr->set_reg);
reg_e = pr->set_reg;
reg_d = pr->set_reg;
}
--
2.34.1