Commit 57b0031b authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

[PATCH] USB: Small correction to usb-skeleton.c

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.
parent fd82bf1c
......@@ -646,9 +646,6 @@ static void skel_disconnect(struct usb_interface *interface)
dev = usb_get_intfdata (interface);
usb_set_intfdata (interface, NULL);
if (!dev)
return;
down (&dev->sem);
/* disable open() */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment