Commit 06819dfe authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

[PATCH] USB: fix error return codes in usblp

this fixes the questionable error return codes Paulo noticed
in usblp. I hope I really got all cases now.
parent b3fa3588
...@@ -610,7 +610,7 @@ static ssize_t usblp_write(struct file *file, const char __user *buffer, size_t ...@@ -610,7 +610,7 @@ static ssize_t usblp_write(struct file *file, const char __user *buffer, size_t
if (!usblp->wcomplete) { if (!usblp->wcomplete) {
barrier(); barrier();
if (file->f_flags & O_NONBLOCK) if (file->f_flags & O_NONBLOCK)
return -EAGAIN; return writecount ? writecount : -EAGAIN;
timeout = USBLP_WRITE_TIMEOUT; timeout = USBLP_WRITE_TIMEOUT;
add_wait_queue(&usblp->wait, &wait); add_wait_queue(&usblp->wait, &wait);
...@@ -673,8 +673,8 @@ static ssize_t usblp_write(struct file *file, const char __user *buffer, size_t ...@@ -673,8 +673,8 @@ static ssize_t usblp_write(struct file *file, const char __user *buffer, size_t
usblp->writeurb->dev = usblp->dev; usblp->writeurb->dev = usblp->dev;
usblp->wcomplete = 0; usblp->wcomplete = 0;
if (usb_submit_urb(usblp->writeurb, GFP_KERNEL)) { if (err = usb_submit_urb(usblp->writeurb, GFP_KERNEL)) {
count = -EIO; count = err != -ENOMEM ? -EIO : (writecount ? writecount : -ENOMEM);
up (&usblp->sem); up (&usblp->sem);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment