media: rc: return proper error code on error handling path in init
authorEvgeny Novikov <novikov@ispras.ru>
Thu, 18 Jun 2020 13:15:38 +0000 (15:15 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sat, 4 Jul 2020 10:23:46 +0000 (12:23 +0200)
If lirc_dev_init() fails during module initialization, rc_core_init()
returns 0 denoting success. This can cause different issues during
further operation of the module. The patch fixes the return value of
rc_core_init() on the corresponding error handling path.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/rc/rc-main.c

index d7064d6..7b53066 100644 (file)
@@ -2052,7 +2052,7 @@ static int __init rc_core_init(void)
        if (rc) {
                pr_err("rc_core: unable to init lirc\n");
                class_unregister(&rc_class);
-               return 0;
+               return rc;
        }
 
        led_trigger_register_simple("rc-feedback", &led_feedback);