On Mon, Mar 30, 2026 at 07:22:52PM +0100, grondon@gmail.com wrote:
> From: Gabriel Rondon <grondon@gmail.com>
>
> 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)
hdm_ch can't be NULL. It's a pointer to the middle of a struct plus
an offset.
regards,
dan carpenter
> + return;
>
> spin_lock_irqsave(&dim_lock, flags);
>
> --
> 2.33.0
>