• Alan Stern's avatar
    [PATCH] USB: Changes to core/config.c (3 of 9) · 580d2f45
    Alan Stern authored
    This patch includes a bunch of little local improvements to the code,
    listed in the patch comments.  There are only two notable changes.  If a
    device has more configurations than our maximum, the code doesn't reject
    the device but simply parses as many configurations as it can and ignores
    the rest.  Likewise, if a configuration contains too many interfaces, the
    code parses as many as it can and skips the excess.  That way such devices
    will be at least partially useable.  Since these limits are arbitrary and
    set by the implementation (not part of the USB spec), it doesn't make
    sense to reject a device that violates them.
    
     Numerous local programming improvements:
       Don't initialize to 0 fields in structures that have been memset to 0.
       Don't constantly keep track of how many bytes are parsed.
       Use local variables to hold unwieldy values.
       Remove redundant tests.
       Allow devices to have more configurations or interfaces than we can handle.
    580d2f45
config.c 12.3 KB