[PATCH v2 2/5] staging: most: dim2: replace BUG_ON() in service_done_flag()

grondon
2026-03-30T18:23:01Z

Replace BUG_ON() calls with an early return since the function returns
void.

BUG_ON() is deprecated as it crashes the entire kernel on assertion
failure (see Documentation/process/deprecated.rst).

Signed-off-by: Gabriel Rondon <grondon@gmail.com>
---
drivers/staging/most/dim2/dim2.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
index 48315f8cd..b820c3647 100644
--- a/drivers/staging/most/dim2/dim2.c
+++ b/drivers/staging/most/dim2/dim2.c
@@ -271,8 +271,8 @@ static void service_done_flag(struct dim2_hdm *dev, int ch_idx)
unsigned long flags;
u8 *data;

- BUG_ON(!hdm_ch);
- BUG_ON(!hdm_ch->is_initialized);
+ if (!hdm_ch || !hdm_ch->is_initialized)
+ return;

spin_lock_irqsave(&dim_lock, flags);

--
2.33.0