On Friday, 18. May 2001 07:44, you wrote:
> Hi,
>
> Attached is a usb-skeleton.c driver that I whipped up to try to provide
> help to beginning usb driver authors (much like the pci-skeleton.c
> driver does.)
>
> I haven't really tested it well, but I thought I would like to get
> comments from the list at this time.  Please let me know if you think
> the driver should have anything else in it, further comments in places,
> or whatever.

A valiant effort.

1)
in open:

        if ((subminor < 0) ||
            (subminor >= MAX_DEVICES)) {
                skel = minor_table[subminor];

Isn't there a ! missing ?

2)
in open:

You increase the module use count after doing a down()
This is a race condition.
Also it is typical, in an example it is serious.

3)
in release:

in the already unplugged case you don't decrease the module use count

4)
in write:

if submitting the URB fails, bytes_written is returned, although they were 
not written.

5)
in write:

copy_from_user is not checked for -EFAULT

6)
in ioctl:

The ioctl handler is called directly.
The correct default return is -ENOTTY

7)
in write:

you release the lock before the URB is completed.
This is deadly.

        Regards
                Oliver

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
http://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to