public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH v3 1/2] staging: most: dim2: replace BUG_ON() in enqueue()
@ 2026-04-12 13:00 Nguyen Duc Thinh
  2026-04-12 13:00 ` [PATCH v3 1/2] staging: most: dim2: replace BUG_ON() in poison_channel() Nguyen Duc Thinh
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Nguyen Duc Thinh @ 2026-04-12 13:00 UTC (permalink / raw)
  To: Luka Gejak; +Cc: gregkh, linux-staging, linux-kernel, Gabriel Rondon

From: Gabriel Rondon <grondon@gmail.com>

Replace BUG_ON() range check on ch_idx with a return of -EINVAL.

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>
Link: https://patch.msgid.link/20260330182255.75241-5-grondon@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/most/dim2/dim2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
index 0b80f313a266..23230a32c2cb 100644
--- a/drivers/staging/most/dim2/dim2.c
+++ b/drivers/staging/most/dim2/dim2.c
@@ -570,7 +570,8 @@ static int enqueue(struct most_interface *most_iface, int ch_idx,
 	struct hdm_channel *hdm_ch = dev->hch + ch_idx;
 	unsigned long flags;
 
-	BUG_ON(ch_idx < 0 || ch_idx >= DMA_CHANNELS);
+	if (ch_idx < 0 || ch_idx >= DMA_CHANNELS)
+		return -EINVAL;
 
 	if (!hdm_ch->is_initialized)
 		return -EPERM;
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-04-12 20:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-12 13:00 [PATCH v3 1/2] staging: most: dim2: replace BUG_ON() in enqueue() Nguyen Duc Thinh
2026-04-12 13:00 ` [PATCH v3 1/2] staging: most: dim2: replace BUG_ON() in poison_channel() Nguyen Duc Thinh
2026-04-12 13:00 ` [PATCH v3 2/2] staging: rtl8723bs: rename dot11AuthAlgrthm to fix CamelCase Nguyen Duc Thinh
2026-04-12 14:37   ` David Laight
2026-04-12 18:52 ` [PATCH v3 1/2] staging: most: dim2: replace BUG_ON() in enqueue() Greg KH
2026-04-12 20:43   ` Luka Gejak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox