]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
staging: most: dim2: replace BUG_ON() in configure_channel()
authorGabriel Rondon <grondon@gmail.com>
Mon, 30 Mar 2026 18:22:53 +0000 (19:22 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 31 Mar 2026 08:46:39 +0000 (10:46 +0200)
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-4-grondon@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/most/dim2/dim2.c

index b820c3647ce5bbdfaba20c299ab85c1263a3375e..0b80f313a266d7840aad499c0eb0d9a751e3d8e7 100644 (file)
@@ -457,7 +457,8 @@ static int configure_channel(struct most_interface *most_iface, int ch_idx,
        int const ch_addr = ch_idx * 2 + 2;
        struct hdm_channel *const hdm_ch = dev->hch + ch_idx;
 
-       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;