mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging: most: dim2: remove unnecessary NULL check in try_start_dim_transfer()
@ 2026-04-01 10:10 grondon
  2026-05-12 11:54 ` Geert Uytterhoeven
  0 siblings, 1 reply; 2+ messages in thread
From: grondon @ 2026-04-01 10:10 UTC (permalink / raw)
  To: gregkh
  Cc: error27, christian.gromm, parthiban.veerasooran, linux-staging,
	linux-kernel, Gabriel Rondon

From: Gabriel Rondon <grondon@gmail.com>

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
point is dead code.

Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/all/acwjEHyEYg0V3OyC@stanley.mountain
Signed-off-by: Gabriel Rondon <grondon@gmail.com>
---
 drivers/staging/most/dim2/dim2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
index f5bd7d44f..327790436 100644
--- 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);
-- 
2.33.0


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

* Re: [PATCH] staging: most: dim2: remove unnecessary NULL check in try_start_dim_transfer()
  2026-04-01 10:10 [PATCH] staging: most: dim2: remove unnecessary NULL check in try_start_dim_transfer() grondon
@ 2026-05-12 11:54 ` Geert Uytterhoeven
  0 siblings, 0 replies; 2+ messages in thread
From: Geert Uytterhoeven @ 2026-05-12 11:54 UTC (permalink / raw)
  To: grondon
  Cc: gregkh, error27, christian.gromm, parthiban.veerasooran,
	linux-staging, linux-kernel

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@gmail.com> wrote:
> From: Gabriel Rondon <grondon@gmail.com>
>
> 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@gmail.com>
> Closes: https://lore.kernel.org/all/acwjEHyEYg0V3OyC@stanley.mountain
> Signed-off-by: Gabriel Rondon <grondon@gmail.com>

> --- 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@linux-m68k.org

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

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

end of thread, other threads:[~2026-05-12 11:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-01 10:10 [PATCH] staging: most: dim2: remove unnecessary NULL check in try_start_dim_transfer() grondon
2026-05-12 11:54 ` Geert Uytterhoeven

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

all inboxes | Powered by JetHome®