Skip to contentSkip to conversation

staging: most: video: replace BUG_ON() in comp_exit

PATCH In review Ajith P V 2 participants 2 messages Apr 16 – Apr 27

Subsystems (2)
lore
Share & tools
lore

Ajith P V

author
#0 lore raw

PATCH 1/1 staging: most: video: replace BUG_ON() in comp_exit

Replace BUG_ON() with WARN_ON() and pr_err inside comp_exit().

BUG_ON() is risky and not recommended to use in kernel. It should replace with proper handlers such as WARN()-family (see Documentation/process/deprecated.rst).

---
 drivers/staging/most/video/video.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/most/video/video.c +2 -1
index 04351f8ccccf..78cbf367c308 100644
@@ -577,7 +577,8 @@ static void __exit comp_exit(void)
 
 	most_deregister_configfs_subsys(&comp);
 	most_deregister_component(&comp);
-	BUG_ON(!list_empty(&video_devices));
+	if (WARN_ON(!list_empty(&video_devices)))
+		pr_err("video_devices list not empty during module exit\n");
 }
 
 module_init(comp_init);
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 28 lines · Ajith P V

Replace BUG_ON() with WARN_ON() and pr_err inside comp_exit().

BUG_ON() is risky and not recommended to use in kernel. It should replace with proper handlers such as WARN()-family (see Documentation/process/deprecated.rst).

---
 drivers/staging/most/video/video.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/most/video/video.c +2 -1
index 04351f8ccccf..78cbf367c308 100644
@@ -577,7 +577,8 @@ static void __exit comp_exit(void)
 
 	most_deregister_configfs_subsys(&comp);
 	most_deregister_component(&comp);
-	BUG_ON(!list_empty(&video_devices));
+	if (WARN_ON(!list_empty(&video_devices)))
+		pr_err("video_devices list not empty during module exit\n");
 }
 
 module_init(comp_init);
Signature · 1 line
2.43.0

This was sent before you:

	https://lore.kernel.org/r/[email protected]

which fixes it properly. Also see all the other times replacing BUG_ON() with WARN_ON() has been rejected by me in the past, so this wouldn't be ok either.

thanks,

greg k-h