diff options
author | Johan Hovold <johan@hovoldconsulting.com> | 2016-05-11 10:18:00 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-05-13 15:30:05 +0200 |
commit | be5d01f10bdb782d31039930a9414c2f880e3430 (patch) | |
tree | 6d277ba8d3291359da74f23b88d4f610b0c86f4f /drivers/staging/greybus/es2.c | |
parent | 74a5d93cee1fb08d8e576888418ddd401aba6713 (diff) | |
download | op-kernel-dev-be5d01f10bdb782d31039930a9414c2f880e3430.zip op-kernel-dev-be5d01f10bdb782d31039930a9414c2f880e3430.tar.gz |
greybus: es2: fix probe error handling
Make sure to return -ENODEV when the expected endpoints are missing and
stop relying on a default error.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/es2.c')
-rw-r--r-- | drivers/staging/greybus/es2.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c index 1cef13d..f8bc3ec 100644 --- a/drivers/staging/greybus/es2.c +++ b/drivers/staging/greybus/es2.c @@ -938,7 +938,7 @@ static int ap_probe(struct usb_interface *interface, struct usb_endpoint_descriptor *endpoint; int bulk_in = 0; int bulk_out = 0; - int retval = -ENOMEM; + int retval; int i; int num_cports; int cport_id; @@ -1002,6 +1002,7 @@ static int ap_probe(struct usb_interface *interface, } if (bulk_in != NUM_BULKS || bulk_out != NUM_BULKS) { dev_err(&udev->dev, "Not enough endpoints found in device, aborting!\n"); + retval = -ENODEV; goto error; } @@ -1014,11 +1015,15 @@ static int ap_probe(struct usb_interface *interface, u8 *buffer; urb = usb_alloc_urb(0, GFP_KERNEL); - if (!urb) + if (!urb) { + retval = -ENOMEM; goto error; + } buffer = kmalloc(ES2_GBUF_MSG_SIZE_MAX, GFP_KERNEL); - if (!buffer) + if (!buffer) { + retval = -ENOMEM; goto error; + } usb_fill_bulk_urb(urb, udev, usb_rcvbulkpipe(udev, @@ -1035,8 +1040,10 @@ static int ap_probe(struct usb_interface *interface, struct urb *urb; urb = usb_alloc_urb(0, GFP_KERNEL); - if (!urb) + if (!urb) { + retval = -ENOMEM; goto error; + } es2->cport_out_urb[i] = urb; es2->cport_out_urb_busy[i] = false; /* just to be anal */ |