Skip to content

Commit

Permalink
Staging: usbip: usbip_start_threads(): handle kernel_thread failure
Browse files Browse the repository at this point in the history
kernel_thread may fail, notice this.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Roel Kluin authored and Greg Kroah-Hartman committed Jan 28, 2009
1 parent e48d94d commit 05d6d67
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions drivers/staging/usbip/usbip_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 05d6d67

Please sign in to comment.