usbatm xusbatm.c,1.2,1.3

Duncan Sands baldrick at
Fri Apr 8 12:01:05 EDT 2005

        int num_drivers = min_t(int,
                                min_t(int, num_vendor, num_product),
                                min_t(int, num_rx_endpoint, num_tx_endpoint));


        if (!num_drivers) {
                warn("malformed module parameters");
                return -EINVAL;

Hi Roman, wouldn't it make more sense to check that they all have the
same length, and reject otherwise.  After all, if you (for example)
give a different number of vendor ids and product ids, most likely
you just made a mistake typing it in, and would rather be told about
it than have the mistake silently ignored.

Also, rather than binding to all available interfaces, you could check
that the asked-for rx and tx endpoints belong to the interface bind is
being called on.

While I'm there I can't help noticing that match_flags, idVendor and
idProduct are of type __u16, not uint.  Maybe ushort is better.



More information about the Usbatm mailing list