public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Matan Cohen <matan@matanco.space>
Cc: linux-staging@lists.linux.dev,
	parthiban.veerasooran@microchip.com,
	christian.gromm@microchip.com, gregkh@linuxfoundation.org
Subject: Re: [PATCH] staging: most: video: replace BUG_ON with WARN_ON_ONCE and add recovery
Date: Mon, 20 Apr 2026 17:14:20 +0300	[thread overview]
Message-ID: <aeY0vL0SEteMZUbz@stanley.mountain> (raw)
In-Reply-To: <20260420113503.62552-1-matan@matanco.space>

On Mon, Apr 20, 2026 at 11:35:03AM +0000, Matan Cohen wrote:
> BUG_ON() halts the kernel unconditionally. The check after
> most_deregister_component() guards against a bug in mostcore: it
> currently does not call disconnect_channel() for linked channels on
> deregistration, so if that ever changes unexpectedly, video_devices
> could be non-empty.
> 
> Replace BUG_ON with WARN_ON_ONCE so the kernel stays up, and add a
> recovery path that drains and frees any remaining devices to avoid
> memory leaks in that error case.
> 
> Also document what the spinlock and mutex in struct most_video_dev
> each protect.
> ---
>  drivers/staging/most/video/video.c | 19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
> index 04351f8ccccf1..4ade49569bd63 100644
> --- a/drivers/staging/most/video/video.c
> +++ b/drivers/staging/most/video/video.c
> @@ -33,14 +33,14 @@ struct most_video_dev {
>  	bool mute;
>  
>  	struct list_head pending_mbos;
> -	spinlock_t list_lock;
> +	spinlock_t list_lock; /* protects pending_mbos and mute */

I always dread these kinds of patches...  The comment is useless.  Way
too vague and kind of wrong also.  I want to see a much more thorough
explanation.

regards,
dan carpenter


  parent reply	other threads:[~2026-04-20 14:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-20 11:35 [PATCH] staging: most: video: replace BUG_ON with WARN_ON_ONCE and add recovery Matan Cohen
2026-04-20 12:35 ` Greg KH
2026-04-20 14:14 ` Dan Carpenter [this message]
2026-04-21 15:15   ` Matan Cohen
2026-04-21 15:22     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aeY0vL0SEteMZUbz@stanley.mountain \
    --to=error27@gmail.com \
    --cc=christian.gromm@microchip.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=matan@matanco.space \
    --cc=parthiban.veerasooran@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox