• Alan Stern's avatar
    [PATCH] USB: Small correction to usb-skeleton.c · 57b0031b
    Alan Stern authored
    This fixes a minor error in usb-skeleton's disconnect() routine: if the
    interface's private data is NULL, the current code exits without releasing
    the disconnect_sem semaphore.
    
    I removed the test entirely because I can't think of any situation where
    that private data actually would be NULL, other than a pretty badly
    malfunctioning system.  Why test for something that should never happen?
    And if it does happen, we shouldn't want the disconnect routine to fail
    silently -- we should want to see a nice big segfault (when the NULL
    pointer is dereferenced) so that we can find and fix the underlying error.
    
    Is there any sort of convention (a la Documentation/CodingStyle) about
    whether this approach should be used in general?  There are _lots_ of
    places in the kernel where unnecessary checks for NULL pointers are made.
    57b0031b
usb-skeleton.c 18.8 KB