Skip to contentSkip to conversation

media: siano: Fix error handling in smsdvb_module_init()

PATCH In review Yuan Can 2 participants 2 messages Oct 22, 2024

Subsystems (2)
lore
Share & tools
lore

Yuan Can

author
#0 lore raw

PATCH 1/1 media: siano: Fix error handling in smsdvb_module_init()

The smsdvb_module_init() returns without checking the retval from smscore_register_hotplug().
If the smscore_register_hotplug() failed, the module failed to install, leaving the smsdvb_debugfs not unregistered.

Fixes 3f6b87cff66b ("[media] siano: allow showing the complete statistics via debugfs")
---
 drivers/media/common/siano/smsdvb-main.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/common/siano/smsdvb-main.c +2 -0
index 44d8fe8b220e..9b1a650ed055 100644
@@ -1243,6 +1243,8 @@ static int __init smsdvb_module_init(void)
 	smsdvb_debugfs_register();
 
 	rc = smscore_register_hotplug(smsdvb_hotplug);
+	if (rc)
+		smsdvb_debugfs_unregister();
 
 	pr_debug("\n");
 
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Yuan Can

The smsdvb_module_init() returns without checking the retval from smscore_register_hotplug().
If the smscore_register_hotplug() failed, the module failed to install, leaving the smsdvb_debugfs not unregistered.

Fixes 3f6b87cff66b ("[media] siano: allow showing the complete statistics via debugfs")
Quoted 20 lines
---
 drivers/media/common/siano/smsdvb-main.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/common/siano/smsdvb-main.c +2 -1
index 44d8fe8b220e..9b1a650ed055 100644
@@ -1243,6 +1243,8 @@ static int __init smsdvb_module_init(void)
        smsdvb_debugfs_register();
 
        rc = smscore_register_hotplug(smsdvb_hotplug);
+       if (rc)
+               smsdvb_debugfs_unregister();
 
        pr_debug("\n");
 
--

2.17.1

Signature · 1 line
Ricardo Ribalda