diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2007-03-06 05:47:44 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-03-09 22:52:25 -0500 |
commit | ee17b289732e04fdcdd8ce2ce19b18d3e8b08e20 (patch) | |
tree | 4506f7400f7bde608339d286f6ca4c3fd316fe09 /drivers/usb | |
parent | 834dbca5b6b79ddb7cf56001ea7b6d4481fdf1e7 (diff) |
USB Elan FTDI: check for workqueue creation
Avoid NULL pointer usage if workqueue creation failed.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Pete Zaitcev <zaitcev@redhat.com>
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, 16 insertions, 2 deletions
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c index 0c1d66ddb812..bc3327e3dd78 100644 --- a/drivers/usb/misc/ftdi-elan.c +++ b/drivers/usb/misc/ftdi-elan.c | |||
@@ -2905,17 +2905,31 @@ static int __init ftdi_elan_init(void) | |||
2905 | { | 2905 | { |
2906 | int result; | 2906 | int result; |
2907 | printk(KERN_INFO "driver %s built at %s on %s\n", ftdi_elan_driver.name, | 2907 | printk(KERN_INFO "driver %s built at %s on %s\n", ftdi_elan_driver.name, |
2908 | __TIME__, __DATE__); | 2908 | __TIME__, __DATE__); |
2909 | init_MUTEX(&ftdi_module_lock); | 2909 | init_MUTEX(&ftdi_module_lock); |
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) | ||
2913 | goto err1; | ||
2912 | command_queue = create_singlethread_workqueue("ftdi-command-engine"); | 2914 | command_queue = create_singlethread_workqueue("ftdi-command-engine"); |
2915 | if (!command_queue) | ||
2916 | goto err2; | ||
2913 | respond_queue = create_singlethread_workqueue("ftdi-respond-engine"); | 2917 | respond_queue = create_singlethread_workqueue("ftdi-respond-engine"); |
2918 | if (!respond_queue) | ||
2919 | goto err3; | ||
2914 | result = usb_register(&ftdi_elan_driver); | 2920 | result = usb_register(&ftdi_elan_driver); |
2915 | if (result) | 2921 | if (result) |
2916 | printk(KERN_ERR "usb_register failed. Error number %d\n", | 2922 | printk(KERN_ERR "usb_register failed. Error number %d\n", |
2917 | result); | 2923 | result); |
2918 | return result; | 2924 | return result; |
2925 | |||
2926 | err3: | ||
2927 | destroy_workqueue(command_queue); | ||
2928 | err2: | ||
2929 | destroy_workqueue(status_queue); | ||
2930 | err1: | ||
2931 | printk(KERN_ERR "%s couldn't create workqueue\n", ftdi_elan_driver.name); | ||
2932 | return -ENOMEM; | ||
2919 | } | 2933 | } |
2920 | 2934 | ||
2921 | static void __exit ftdi_elan_exit(void) | 2935 | static void __exit ftdi_elan_exit(void) |