]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
greybus: es2: fix endpoint requirement check
authorJohan Hovold <johan@hovoldconsulting.com>
Wed, 4 Nov 2015 17:55:13 +0000 (18:55 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 5 Nov 2015 04:35:18 +0000 (20:35 -0800)
The current es2 implementation only checks for no IN or OUT bulk
endpoints, but still assumes there are precisely NUM_BULKS of each.

Specifically, urbs could be allocated and initialised to default values,
which amounts to bulk urbs being submitted to the control endpoint.

We should be able to handle any number of endpoints, but for now let's
just require NUM_BULKS of each.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/es2.c

index ebf41f740ccc5e6da35f47cb26c7346591c9b9f0..4bb500f65873d7a07de0b7ec126a5a5a689a53f9 100644 (file)
@@ -848,8 +848,7 @@ static int ap_probe(struct usb_interface *interface,
                                endpoint->bEndpointAddress);
                }
        }
-       if ((bulk_in == 0) ||
-           (bulk_out == 0)) {
+       if (bulk_in != NUM_BULKS || bulk_out != NUM_BULKS) {
                dev_err(&udev->dev, "Not enough endpoints found in device, aborting!\n");
                goto error;
        }