Staging: usbip: usbip_start_threads(): handle kernel_thread failure
authorRoel Kluin <roel.kluin@gmail.com>
Fri, 19 Dec 2008 22:37:30 +0000 (23:37 +0100)
committerGreg Kroah-Hartman <gregkh@kvm.kroah.org>
Wed, 28 Jan 2009 23:49:05 +0000 (15:49 -0800)
kernel_thread may fail, notice this.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/usbip/usbip_common.c

index 72e209276ea74b6af2bef0b439f053ff3689c9b6..22f93dd0ba034ac741dcba70642fbf5272957070 100644 (file)
@@ -406,8 +406,20 @@ void usbip_start_threads(struct usbip_device *ud)
        /*
         * threads are invoked per one device (per one connection).
         */
-       kernel_thread(usbip_thread, (void *)&ud->tcp_rx, 0);
-       kernel_thread(usbip_thread, (void *)&ud->tcp_tx, 0);
+       int retval;
+
+       retval = kernel_thread(usbip_thread, (void *)&ud->tcp_rx, 0);
+       if (retval < 0) {
+               printk(KERN_ERR "Creating tcp_rx thread for ud %p failed.\n",
+                               ud);
+               return;
+       }
+       retval = kernel_thread(usbip_thread, (void *)&ud->tcp_tx, 0);
+       if (retval < 0) {
+               printk(KERN_ERR "Creating tcp_tx thread for ud %p failed.\n",
+                               ud);
+               return;
+       }
 
        /* confirm threads are starting */
        wait_for_completion(&ud->tcp_rx.thread_done);