USB: serial: ir-usb: simplify endpoint check
authorJohan Hovold <johan@kernel.org>
Wed, 22 Jan 2020 10:15:30 +0000 (11:15 +0100)
committerJohan Hovold <johan@kernel.org>
Thu, 23 Jan 2020 08:11:36 +0000 (09:11 +0100)
Simplify the endpoint sanity check by letting core verify that the
required endpoints are present.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/ir-usb.c

index 3cd7039..79d0586 100644 (file)
@@ -76,6 +76,8 @@ static struct usb_serial_driver ir_device = {
        .description            = "IR Dongle",
        .id_table               = ir_id_table,
        .num_ports              = 1,
+       .num_bulk_in            = 1,
+       .num_bulk_out           = 1,
        .set_termios            = ir_set_termios,
        .attach                 = ir_startup,
        .write                  = ir_write,
@@ -197,9 +199,6 @@ static int ir_startup(struct usb_serial *serial)
        struct usb_irda_cs_descriptor *irda_desc;
        int rates;
 
-       if (serial->num_bulk_in < 1 || serial->num_bulk_out < 1)
-               return -ENODEV;
-
        irda_desc = irda_usb_find_class_desc(serial, 0);
        if (!irda_desc) {
                dev_err(&serial->dev->dev,