Skip to content

Commit

Permalink
USB: serial: ark3116: fix endpoint-check return value
Browse files Browse the repository at this point in the history
Return -ENODEV rather than -EINVAL on probe errors due to a missing
endpoint.

Also clean up the endpoint sanity check somewhat and use the interface
device for logging a more compact error in case an expected endpoint is
missing.

Reviewed-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Johan Hovold <[email protected]>
  • Loading branch information
jhovold committed Jan 31, 2017
1 parent ea534e0 commit 4481200
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions drivers/usb/serial/ark3116.c
Original file line number Diff line number Diff line change
@@ -125,17 +125,11 @@ static inline int calc_divisor(int bps)
static int ark3116_attach(struct usb_serial *serial)
{
/* make sure we have our end-points */
if ((serial->num_bulk_in == 0) ||
(serial->num_bulk_out == 0) ||
(serial->num_interrupt_in == 0)) {
dev_err(&serial->dev->dev,
"%s - missing endpoint - "
"bulk in: %d, bulk out: %d, int in %d\n",
KBUILD_MODNAME,
serial->num_bulk_in,
serial->num_bulk_out,
serial->num_interrupt_in);
return -EINVAL;
if (serial->num_bulk_in == 0 ||
serial->num_bulk_out == 0 ||
serial->num_interrupt_in == 0) {
dev_err(&serial->interface->dev, "missing endpoint\n");
return -ENODEV;
}

return 0;

0 comments on commit 4481200

Please sign in to comment.