diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2007-04-26 03:38:00 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-04-27 16:28:40 -0400 |
commit | 893a342a686e6ce36ef24d322f3f52420a041313 (patch) | |
tree | 8517bcfef656ec37b5669f40d9723b8272a59cff /drivers/usb | |
parent | f094e4f358c2f9f0a46dc777f64ed7794f73d283 (diff) |
USB Elan FTDI: check for driver registration status
Add checking of driver registration status and release allocated resources
if it failed.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: "Luiz Fernando N. Capitulino" <lcapitulino@mandriva.com.br>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/misc/ftdi-elan.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c index bc3327e3dd78..d9cbdb87fac2 100644 --- a/drivers/usb/misc/ftdi-elan.c +++ b/drivers/usb/misc/ftdi-elan.c | |||
@@ -2910,24 +2910,28 @@ static int __init ftdi_elan_init(void) | |||
2910 | INIT_LIST_HEAD(&ftdi_static_list); | 2910 | INIT_LIST_HEAD(&ftdi_static_list); |
2911 | status_queue = create_singlethread_workqueue("ftdi-status-control"); | 2911 | status_queue = create_singlethread_workqueue("ftdi-status-control"); |
2912 | if (!status_queue) | 2912 | if (!status_queue) |
2913 | goto err1; | 2913 | goto err_status_queue; |
2914 | command_queue = create_singlethread_workqueue("ftdi-command-engine"); | 2914 | command_queue = create_singlethread_workqueue("ftdi-command-engine"); |
2915 | if (!command_queue) | 2915 | if (!command_queue) |
2916 | goto err2; | 2916 | goto err_command_queue; |
2917 | respond_queue = create_singlethread_workqueue("ftdi-respond-engine"); | 2917 | respond_queue = create_singlethread_workqueue("ftdi-respond-engine"); |
2918 | if (!respond_queue) | 2918 | if (!respond_queue) |
2919 | goto err3; | 2919 | goto err_respond_queue; |
2920 | result = usb_register(&ftdi_elan_driver); | 2920 | result = usb_register(&ftdi_elan_driver); |
2921 | if (result) | 2921 | if (result) { |
2922 | destroy_workqueue(status_queue); | ||
2923 | destroy_workqueue(command_queue); | ||
2924 | destroy_workqueue(respond_queue); | ||
2922 | printk(KERN_ERR "usb_register failed. Error number %d\n", | 2925 | printk(KERN_ERR "usb_register failed. Error number %d\n", |
2923 | result); | 2926 | result); |
2927 | } | ||
2924 | return result; | 2928 | return result; |
2925 | 2929 | ||
2926 | err3: | 2930 | err_respond_queue: |
2927 | destroy_workqueue(command_queue); | 2931 | destroy_workqueue(command_queue); |
2928 | err2: | 2932 | err_command_queue: |
2929 | destroy_workqueue(status_queue); | 2933 | destroy_workqueue(status_queue); |
2930 | err1: | 2934 | err_status_queue: |
2931 | printk(KERN_ERR "%s couldn't create workqueue\n", ftdi_elan_driver.name); | 2935 | printk(KERN_ERR "%s couldn't create workqueue\n", ftdi_elan_driver.name); |
2932 | return -ENOMEM; | 2936 | return -ENOMEM; |
2933 | } | 2937 | } |