Skip to contentSkip to conversation

staging: most: video: replace BUG_ON with WARN_ON_ONCE

PATCH In review Iman Reihanian 2 participants 2 messages Mar 6 – Mar 8

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: most: video: replace BUG_ON with WARN_ON_ONCE

BUG_ON causes a kernel panic if the condition is true, which is too severe for this cleanup check on module exit. Replace it with WARN_ON_ONCE to emit a warning and allow the system to continue.

---
 drivers/staging/most/video/video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/most/video/video.c +1 -1
index 04351f8ccccf..279ec98aa70e 100644
@@ -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_ONCE(!list_empty(&video_devices));
 }
 
 module_init(comp_init);
Signature · 1 line
2.39.5
maintainer
#1 lore raw
Quoted 14 lines · Iman Reihanian

BUG_ON causes a kernel panic if the condition is true, which is too severe for this cleanup check on module exit. Replace it with WARN_ON_ONCE to emit a warning and allow the system to continue.

---
 drivers/staging/most/video/video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/most/video/video.c +0 -0
index 04351f8ccccf..279ec98aa70e 100644

drivers/staging/most/video/video.c static void __exit comp_exit(void) · line 580

Quoted 5 lines
drivers/staging/most/video/video.c +1 -1
@@ -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_ONCE(!list_empty(&video_devices));

This really doesn't "solve" anything, does it? If panic-on-warn is enabled, you still crashed the machine :(

How about fixing the root cause if this could ever happen?

thanks,

greg k-h