Skip to content

Commit

Permalink
USB: cdc-wdm: cleanup error codes
Browse files Browse the repository at this point in the history
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The internal error codes returned in the write() code
path cannot be simply passed on to user space.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Tested-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Oliver Neukum authored and Greg Kroah-Hartman committed Apr 30, 2012
1 parent 880bca3 commit 12a98b2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/usb/class/cdc-wdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ static ssize_t wdm_write
r = usb_autopm_get_interface(desc->intf);
if (r < 0) {
kfree(buf);
rv = usb_translate_errors(r);
goto outnp;
}

Expand All @@ -383,6 +384,7 @@ static ssize_t wdm_write

if (r < 0) {
kfree(buf);
rv = r;
goto out;
}

Expand Down Expand Up @@ -412,6 +414,7 @@ static ssize_t wdm_write
kfree(buf);
clear_bit(WDM_IN_USE, &desc->flags);
dev_err(&desc->intf->dev, "Tx URB error: %d\n", rv);
rv = usb_translate_errors(rv);
} else {
dev_dbg(&desc->intf->dev, "Tx URB has been submitted index=%d",
req->wIndex);
Expand Down Expand Up @@ -593,6 +596,7 @@ static int wdm_open(struct inode *inode, struct file *file)
desc->count--;
dev_err(&desc->intf->dev,
"Error submitting int urb - %d\n", rv);
rv = usb_translate_errors(rv);
}
} else {
rv = 0;
Expand Down

0 comments on commit 12a98b2

Please sign in to comment.