diff mbox series

media: siano: Fix error handling in smsdvb_module_init()

Message ID 20241022065037.54572-1-yuancan@huawei.com (mailing list archive)
State New
Headers show
Series media: siano: Fix error handling in smsdvb_module_init() | expand

Commit Message

Yuan Can Oct. 22, 2024, 6:50 a.m. UTC
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")
Signed-off-by: Yuan Can <yuancan@huawei.com>
---
 drivers/media/common/siano/smsdvb-main.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Ricardo Ribalda Oct. 22, 2024, 7:35 a.m. UTC | #1
On Tue, 22 Oct 2024 at 08:55, Yuan Can <yuancan@huawei.com> wrote:
>
> 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")
> Signed-off-by: Yuan Can <yuancan@huawei.com>
Acked-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
>  drivers/media/common/siano/smsdvb-main.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/media/common/siano/smsdvb-main.c b/drivers/media/common/siano/smsdvb-main.c
> index 44d8fe8b220e..9b1a650ed055 100644
> --- a/drivers/media/common/siano/smsdvb-main.c
> +++ b/drivers/media/common/siano/smsdvb-main.c
> @@ -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
>
diff mbox series

Patch

diff --git a/drivers/media/common/siano/smsdvb-main.c b/drivers/media/common/siano/smsdvb-main.c
index 44d8fe8b220e..9b1a650ed055 100644
--- a/drivers/media/common/siano/smsdvb-main.c
+++ b/drivers/media/common/siano/smsdvb-main.c
@@ -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");