struct usb_endpoint_descriptor *epd;
        unsigned int i;
 
+       BUILD_BUG_ON(ARRAY_SIZE(epds->bulk_in) < USB_MAXENDPOINTS / 2);
+       BUILD_BUG_ON(ARRAY_SIZE(epds->bulk_out) < USB_MAXENDPOINTS / 2);
+       BUILD_BUG_ON(ARRAY_SIZE(epds->interrupt_in) < USB_MAXENDPOINTS / 2);
+       BUILD_BUG_ON(ARRAY_SIZE(epds->interrupt_out) < USB_MAXENDPOINTS / 2);
+
        iface_desc = serial->interface->cur_altsetting;
        for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
                epd = &iface_desc->endpoint[i].desc;
 
                if (usb_endpoint_is_bulk_in(epd)) {
                        dev_dbg(dev, "found bulk in on endpoint %u\n", i);
-                       if (epds->num_bulk_in == MAX_NUM_PORTS)
-                               continue;
                        epds->bulk_in[epds->num_bulk_in++] = epd;
                } else if (usb_endpoint_is_bulk_out(epd)) {
                        dev_dbg(dev, "found bulk out on endpoint %u\n", i);
-                       if (epds->num_bulk_out == MAX_NUM_PORTS)
-                               continue;
                        epds->bulk_out[epds->num_bulk_out++] = epd;
                } else if (usb_endpoint_is_int_in(epd)) {
                        dev_dbg(dev, "found interrupt in on endpoint %u\n", i);
-                       if (epds->num_interrupt_in == MAX_NUM_PORTS)
-                               continue;
                        epds->interrupt_in[epds->num_interrupt_in++] = epd;
                } else if (usb_endpoint_is_int_out(epd)) {
                        dev_dbg(dev, "found interrupt out on endpoint %u\n", i);
-                       if (epds->num_interrupt_out == MAX_NUM_PORTS)
-                               continue;
                        epds->interrupt_out[epds->num_interrupt_out++] = epd;
                }
        }