ChangeSet 1.1372.2.5, 2003/07/09 20:51:38-07:00, stern@rowland.harvard.edu

[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.


 drivers/usb/usb-skeleton.c |    3 ---
 1 files changed, 3 deletions(-)


diff -Nru a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
--- a/drivers/usb/usb-skeleton.c	Thu Jul 10 16:01:34 2003
+++ b/drivers/usb/usb-skeleton.c	Thu Jul 10 16:01:34 2003
@@ -646,9 +646,6 @@
 	dev = usb_get_intfdata (interface);
 	usb_set_intfdata (interface, NULL);
 
-	if (!dev)
-		return;
-
 	down (&dev->sem);
 
 	/* disable open() */
