]> git.hungrycats.org Git - linux/commitdiff
[PATCH] tiny race with devfs in printer
authorOliver Neukum <oliver@neukum.name>
Thu, 2 May 2002 07:31:51 +0000 (00:31 -0700)
committerGreg Kroah-Hartman <greg@kroah.com>
Thu, 2 May 2002 07:31:51 +0000 (00:31 -0700)
USB printer bugfix

looking through printer.c in preparation for shifting devfs
support to usbcore I noticed that printer advertises a device
through devfs before it can be opened.
As devfs, or more precisely devfsd can be used to trigger actions
this matters and is wrong.

drivers/usb/class/printer.c

index 7a589cbd95697b2a28a172d19d7339b5e0a6b76f..150574d36a3e50f2813d5a8ac50bf1c9de3d80b1 100644 (file)
@@ -871,6 +871,9 @@ static void *usblp_probe(struct usb_device *dev, unsigned int ifnum,
        usblp_check_status(usblp, 0);
 #endif
 
+       /* add a table entry so the device works when advertised */
+       usblp_table[usblp->minor] = usblp;
+
        /* If we have devfs, create with perms=660. */
        sprintf(name, "lp%d", usblp->minor);
        usblp->devfs = devfs_register(usb_devfs_handle, name,
@@ -886,7 +889,7 @@ static void *usblp_probe(struct usb_device *dev, unsigned int ifnum,
                usblp->current_protocol, usblp->dev->descriptor.idVendor,
                usblp->dev->descriptor.idProduct);
 
-       return usblp_table[usblp->minor] = usblp;
+       return usblp;
 
 abort:
        if (usblp) {