diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2016-07-19 07:24:42 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-09-22 11:34:37 -0400 |
commit | 0ea92c50ad0d3c20db5ad4ee71bc6588baf1dfa9 (patch) | |
tree | c145bc061f2a5db0fa17a510427bfe2fad4fe7ea | |
parent | 4a86bc1008e7202b49ccb59f52d7a6be9311ef7d (diff) |
[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 <yongjun_wei@trendmicro.com.cn>
-rw-r--r-- | drivers/staging/media/lirc/lirc_parallel.c | 10 |
1 files 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) | |||
650 | if (!pport) { | 650 | if (!pport) { |
651 | pr_notice("no port at %x found\n", io); | 651 | pr_notice("no port at %x found\n", io); |
652 | result = -ENXIO; | 652 | result = -ENXIO; |
653 | goto exit_device_put; | 653 | goto exit_device_del; |
654 | } | 654 | } |
655 | ppdevice = parport_register_device(pport, LIRC_DRIVER_NAME, | 655 | ppdevice = parport_register_device(pport, LIRC_DRIVER_NAME, |
656 | pf, kf, lirc_lirc_irq_handler, 0, | 656 | pf, kf, lirc_lirc_irq_handler, 0, |
@@ -659,7 +659,7 @@ static int __init lirc_parallel_init(void) | |||
659 | if (!ppdevice) { | 659 | if (!ppdevice) { |
660 | pr_notice("parport_register_device() failed\n"); | 660 | pr_notice("parport_register_device() failed\n"); |
661 | result = -ENXIO; | 661 | result = -ENXIO; |
662 | goto exit_device_put; | 662 | goto exit_device_del; |
663 | } | 663 | } |
664 | if (parport_claim(ppdevice) != 0) | 664 | if (parport_claim(ppdevice) != 0) |
665 | goto skip_init; | 665 | goto skip_init; |
@@ -678,7 +678,7 @@ static int __init lirc_parallel_init(void) | |||
678 | parport_release(pport); | 678 | parport_release(pport); |
679 | parport_unregister_device(ppdevice); | 679 | parport_unregister_device(ppdevice); |
680 | result = -EIO; | 680 | result = -EIO; |
681 | goto exit_device_put; | 681 | goto exit_device_del; |
682 | } | 682 | } |
683 | 683 | ||
684 | #endif | 684 | #endif |
@@ -695,11 +695,13 @@ static int __init lirc_parallel_init(void) | |||
695 | pr_notice("register_chrdev() failed\n"); | 695 | pr_notice("register_chrdev() failed\n"); |
696 | parport_unregister_device(ppdevice); | 696 | parport_unregister_device(ppdevice); |
697 | result = -EIO; | 697 | result = -EIO; |
698 | goto exit_device_put; | 698 | goto exit_device_del; |
699 | } | 699 | } |
700 | pr_info("installed using port 0x%04x irq %d\n", io, irq); | 700 | pr_info("installed using port 0x%04x irq %d\n", io, irq); |
701 | return 0; | 701 | return 0; |
702 | 702 | ||
703 | exit_device_del: | ||
704 | platform_device_del(lirc_parallel_dev); | ||
703 | exit_device_put: | 705 | exit_device_put: |
704 | platform_device_put(lirc_parallel_dev); | 706 | platform_device_put(lirc_parallel_dev); |
705 | exit_driver_unregister: | 707 | exit_driver_unregister: |