[media] staging: lirc: add missing platform_device_del() on error
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Tue, 19 Jul 2016 11:24:42 +0000 (08:24 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Thu, 22 Sep 2016 15:34:37 +0000 (12:34 -0300)
Add the missing platform_device_del() before return from
lirc_parallel_init() in the error handling case.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
drivers/staging/media/lirc/lirc_parallel.c

index 3906ac6e686d7d2d7026b9320c05da70d6ba7246..878fdea6b11101f9117e10bded15fe9f906f8e23 100644 (file)
@@ -650,7 +650,7 @@ static int __init lirc_parallel_init(void)
        if (!pport) {
                pr_notice("no port at %x found\n", io);
                result = -ENXIO;
-               goto exit_device_put;
+               goto exit_device_del;
        }
        ppdevice = parport_register_device(pport, LIRC_DRIVER_NAME,
                                           pf, kf, lirc_lirc_irq_handler, 0,
@@ -659,7 +659,7 @@ static int __init lirc_parallel_init(void)
        if (!ppdevice) {
                pr_notice("parport_register_device() failed\n");
                result = -ENXIO;
-               goto exit_device_put;
+               goto exit_device_del;
        }
        if (parport_claim(ppdevice) != 0)
                goto skip_init;
@@ -678,7 +678,7 @@ static int __init lirc_parallel_init(void)
                parport_release(pport);
                parport_unregister_device(ppdevice);
                result = -EIO;
-               goto exit_device_put;
+               goto exit_device_del;
        }
 
 #endif
@@ -695,11 +695,13 @@ static int __init lirc_parallel_init(void)
                pr_notice("register_chrdev() failed\n");
                parport_unregister_device(ppdevice);
                result = -EIO;
-               goto exit_device_put;
+               goto exit_device_del;
        }
        pr_info("installed using port 0x%04x irq %d\n", io, irq);
        return 0;
 
+exit_device_del:
+       platform_device_del(lirc_parallel_dev);
 exit_device_put:
        platform_device_put(lirc_parallel_dev);
 exit_driver_unregister: