From 0ea92c50ad0d3c20db5ad4ee71bc6588baf1dfa9 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Tue, 19 Jul 2016 08:24:42 -0300 Subject: [PATCH] [media] staging: lirc: add missing platform_device_del() on error Add the missing platform_device_del() before return from lirc_parallel_init() in the error handling case. Signed-off-by: Wei Yongjun --- drivers/staging/media/lirc/lirc_parallel.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_parallel.c b/drivers/staging/media/lirc/lirc_parallel.c index 3906ac6e686d..878fdea6b111 100644 --- a/drivers/staging/media/lirc/lirc_parallel.c +++ b/drivers/staging/media/lirc/lirc_parallel.c @@ -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: -- 2.30.2