]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
USB: serial: mxuport: add endpoint sanity check
authorJohan Hovold <johan@kernel.org>
Thu, 16 Mar 2017 16:13:55 +0000 (17:13 +0100)
committerJohan Hovold <johan@kernel.org>
Tue, 28 Mar 2017 09:14:12 +0000 (11:14 +0200)
Add an explicit sanity check to make sure we have the expected
endpoints. This will provide a descriptive error message in case an
expected endpoint is missing when probing.

Note that the driver already gracefully fails to probe (albeit with a
less descriptive error message) if a bulk-in endpoint is missing, and an
attempt to write to a port whose device lack a bulk-out endpoint would
fail with -ENODEV.

Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/mxuport.c

index 3355737cbfd19b1fb1be682a3448c0d1957a288d..34142feffd4db7fe9f58c42629f383971d2ea209 100644 (file)
@@ -1373,6 +1373,8 @@ static struct usb_serial_driver mxuport_device = {
        },
        .description            = "MOXA UPort",
        .id_table               = mxuport_idtable,
+       .num_bulk_in            = 2,
+       .num_bulk_out           = 1,
        .probe                  = mxuport_probe,
        .port_probe             = mxuport_port_probe,
        .attach                 = mxuport_attach,