Greg:

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.

Alan Stern


===== usb-skeleton.c 1.54 vs edited =====
--- 1.54/drivers/usb/usb-skeleton.c     Wed Jul  2 12:28:41 2003
+++ edited/drivers/usb/usb-skeleton.c   Mon Jul  7 10:13:30 2003
@@ -646,9 +646,6 @@
        dev = usb_get_intfdata (interface);
        usb_set_intfdata (interface, NULL);
 
-       if (!dev)
-               return;
-
        down (&dev->sem);
 
        /* disable open() */
 



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to