public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] staging: most: video: replace BUG_ON() with WARN_ON_ONCE()
@ 2025-11-21 19:09 Pavan Kumar Yalagada
  2025-11-22  6:50 ` Greg KH
  2025-11-24  8:05 ` Dan Carpenter
  0 siblings, 2 replies; 3+ messages in thread
From: Pavan Kumar Yalagada @ 2025-11-21 19:09 UTC (permalink / raw)
  To: parthiban.veerasooran, christian.gromm
  Cc: gregkh, laurent.pinchart+renesas, hverkuil+cisco, linux-staging,
	Pavan Kumar Yalagada

checkpatch.pl recommends replacing BUG_ON() with WARN_ON_ONCE()
to avoid a kernel panic.

Signed-off-by: Pavan Kumar Yalagada <pavankumaryalagada@gmail.com>
---
 drivers/staging/most/video/video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
index 32f71d9a9cf7..3a622bd597e6 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -575,7 +575,7 @@ static void __exit comp_exit(void)
 
 	most_deregister_configfs_subsys(&comp);
 	most_deregister_component(&comp);
-	BUG_ON(!list_empty(&video_devices));
+	WARN_ON_ONCE(!list_empty(&video_devices));
 }
 
 module_init(comp_init);
-- 
2.47.3


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

* Re: [PATCH] staging: most: video: replace BUG_ON() with WARN_ON_ONCE()
  2025-11-21 19:09 [PATCH] staging: most: video: replace BUG_ON() with WARN_ON_ONCE() Pavan Kumar Yalagada
@ 2025-11-22  6:50 ` Greg KH
  2025-11-24  8:05 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2025-11-22  6:50 UTC (permalink / raw)
  To: Pavan Kumar Yalagada
  Cc: parthiban.veerasooran, christian.gromm, laurent.pinchart+renesas,
	hverkuil+cisco, linux-staging

On Fri, Nov 21, 2025 at 02:09:09PM -0500, Pavan Kumar Yalagada wrote:
> checkpatch.pl recommends replacing BUG_ON() with WARN_ON_ONCE()
> to avoid a kernel panic.
> 
> Signed-off-by: Pavan Kumar Yalagada <pavankumaryalagada@gmail.com>
> ---
>  drivers/staging/most/video/video.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
> index 32f71d9a9cf7..3a622bd597e6 100644
> --- a/drivers/staging/most/video/video.c
> +++ b/drivers/staging/most/video/video.c
> @@ -575,7 +575,7 @@ static void __exit comp_exit(void)
>  
>  	most_deregister_configfs_subsys(&comp);
>  	most_deregister_component(&comp);
> -	BUG_ON(!list_empty(&video_devices));
> +	WARN_ON_ONCE(!list_empty(&video_devices));

But this doesn't handle the fact that the system is now unstable.
Please fix the root cause of this, do not paper over the problem.

thanks,

greg k-h

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

* Re: [PATCH] staging: most: video: replace BUG_ON() with WARN_ON_ONCE()
  2025-11-21 19:09 [PATCH] staging: most: video: replace BUG_ON() with WARN_ON_ONCE() Pavan Kumar Yalagada
  2025-11-22  6:50 ` Greg KH
@ 2025-11-24  8:05 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2025-11-24  8:05 UTC (permalink / raw)
  To: Pavan Kumar Yalagada
  Cc: parthiban.veerasooran, christian.gromm, gregkh,
	laurent.pinchart+renesas, hverkuil+cisco, linux-staging

On Fri, Nov 21, 2025 at 02:09:09PM -0500, Pavan Kumar Yalagada wrote:
> checkpatch.pl recommends replacing BUG_ON() with WARN_ON_ONCE()
> to avoid a kernel panic.
> 
> Signed-off-by: Pavan Kumar Yalagada <pavankumaryalagada@gmail.com>
> ---
>  drivers/staging/most/video/video.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
> index 32f71d9a9cf7..3a622bd597e6 100644
> --- a/drivers/staging/most/video/video.c
> +++ b/drivers/staging/most/video/video.c
> @@ -575,7 +575,7 @@ static void __exit comp_exit(void)
>  
>  	most_deregister_configfs_subsys(&comp);
>  	most_deregister_component(&comp);
> -	BUG_ON(!list_empty(&video_devices));
> +	WARN_ON_ONCE(!list_empty(&video_devices));

The start of the function empties the list.  So the list would only
not be empty if something were adding new entries to it via the
comp_probe_channel() function.

So what is preventing us from adding new stuff once comp_exit()
starts being called?  Figure that bit out.  Fix the bug, don't
add a warning about the bug.

regards,
dan carpenter


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

end of thread, other threads:[~2025-11-24  8:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-21 19:09 [PATCH] staging: most: video: replace BUG_ON() with WARN_ON_ONCE() Pavan Kumar Yalagada
2025-11-22  6:50 ` Greg KH
2025-11-24  8:05 ` Dan Carpenter

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