Re: [PATCH] staging: most: video: replace BUG_ON() with WARN_ON() in comp_exit()

From: Greg Kroah-Hartman

Date: Wed Apr 08 2026 - 06:50:40 EST


On Wed, Apr 08, 2026 at 10:00:24AM +0100, Gabriel Rondon wrote:
> Replace BUG_ON(!list_empty(&video_devices)) with WARN_ON() in the
> module exit function. BUG_ON() is deprecated as it crashes the entire
> kernel on assertion failure (see Documentation/process/deprecated.rst).
> WARN_ON() logs the unexpected condition without bringing down the
> system.
>
> This is the last remaining BUG_ON() in the staging/most subsystem,
> following the dim2 series that replaced five BUG_ON() calls.
>
> Signed-off-by: Gabriel Rondon <grondon@xxxxxxxxx>
> ---
> 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 04351f8ccccf..17cdbea2e55a 100644
> --- a/drivers/staging/most/video/video.c
> +++ b/drivers/staging/most/video/video.c
> @@ -577,7 +577,7 @@ static void __exit comp_exit(void)
>
> most_deregister_configfs_subsys(&comp);
> most_deregister_component(&comp);
> - BUG_ON(!list_empty(&video_devices));
> + WARN_ON(!list_empty(&video_devices));

WARN_ON() also crashes the system when panic-on-warn is enabled (as it
is in a few billion Linux systems...)

So please handle this properly, don't crash.

thanks,

greg k-h