[PATCH v2 3/3] staging: most: video: replace BUG_ON() with proper check

Olle Lukowski posted 3 patches 3 months, 2 weeks ago
[PATCH v2 3/3] staging: most: video: replace BUG_ON() with proper check
Posted by Olle Lukowski 3 months, 2 weeks ago
Replace a BUG_ON() call with a proper check to prevent an unnecessary
kernel panic.

Signed-off-by: Olle Lukowski <olle@lukowski.dev>
---
 drivers/staging/most/video/video.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
index 32f71d9a9..3a7ee2791 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -575,7 +575,8 @@ static void __exit comp_exit(void)
 
 	most_deregister_configfs_subsys(&comp);
 	most_deregister_component(&comp);
-	BUG_ON(!list_empty(&video_devices));
+	if (!list_empty(&video_devices))
+		pr_err("video_devices list not empty during exit\n");
 }
 
 module_init(comp_init);

-- 
2.51.1
Re: [PATCH v2 3/3] staging: most: video: replace BUG_ON() with proper check
Posted by Greg Kroah-Hartman 3 months, 2 weeks ago
On Tue, Oct 21, 2025 at 04:09:30PM +0300, Olle Lukowski wrote:
> Replace a BUG_ON() call with a proper check to prevent an unnecessary
> kernel panic.
> 
> Signed-off-by: Olle Lukowski <olle@lukowski.dev>
> ---
>  drivers/staging/most/video/video.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
> index 32f71d9a9..3a7ee2791 100644
> --- a/drivers/staging/most/video/video.c
> +++ b/drivers/staging/most/video/video.c
> @@ -575,7 +575,8 @@ static void __exit comp_exit(void)
>  
>  	most_deregister_configfs_subsys(&comp);
>  	most_deregister_component(&comp);
> -	BUG_ON(!list_empty(&video_devices));
> +	if (!list_empty(&video_devices))
> +		pr_err("video_devices list not empty during exit\n");

Is this possible to ever have happen?

thanks,

greg k-h