Re: [PATCH] staging: most: dim2: remove unnecessary NULL check in try_start_dim_transfer()
From: Geert Uytterhoeven
Date: Tue May 12 2026 - 07:54:38 EST
Hi Gabriel,
Thanks for your patch, which is now commit fde67f5b1fc77f3c ("staging:
most: dim2: remove unnecessary NULL check in try_start_dim_transfer()")
in staging/staging-next.
On Wed, 1 Apr 2026 at 12:11, <grondon@xxxxxxxxx> wrote:
> From: Gabriel Rondon <grondon@xxxxxxxxx>
>
> Remove the !hdm_ch check. Although hdm_ch is a function parameter,
> it is already dereferenced on the preceding line to initialize
> head (head = &hdm_ch->pending_list), so a NULL check after that
FTR, this is not a pointer dereference, but merely pointer arithmetic,
due to the "&".
> point is dead code.
>
> Reported-by: Dan Carpenter <error27@xxxxxxxxx>
> Closes: https://lore.kernel.org/all/acwjEHyEYg0V3OyC@stanley.mountain
> Signed-off-by: Gabriel Rondon <grondon@xxxxxxxxx>
> --- a/drivers/staging/most/dim2/dim2.c
> +++ b/drivers/staging/most/dim2/dim2.c
> @@ -165,7 +165,7 @@ static int try_start_dim_transfer(struct hdm_channel *hdm_ch)
> unsigned long flags;
> struct dim_ch_state st;
>
> - if (!hdm_ch || !hdm_ch->is_initialized)
> + if (!hdm_ch->is_initialized)
> return -EINVAL;
>
> spin_lock_irqsave(&dim_lock, flags);
The passed hdm_ch can indeed not be NULL, according to the same
rationale as your commit 6aa2b11ce527c23e ("staging: most: dim2: remove
unnecessary NULL check in service_done_flag()") in staging/staging-next.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds