usblp: Don't let suspend to kill ->used
authorPete Zaitcev <zaitcev@redhat.com>
Fri, 25 May 2007 04:59:19 +0000 (21:59 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 8 Jun 2007 23:24:29 +0000 (16:24 -0700)
Suspend destroys refcounting for open/release.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/class/usblp.c

index 7b1edfe46b28b54856a443ecdddeb697b00fe930..6778f9af794381ec0ae40df7253aa26f0bbddfbc 100644 (file)
@@ -347,10 +347,8 @@ static int handle_bidir (struct usblp *usblp)
        if (usblp->bidir && usblp->used && !usblp->sleeping) {
                usblp->readcount = 0;
                usblp->readurb->dev = usblp->dev;
-               if (usb_submit_urb(usblp->readurb, GFP_KERNEL) < 0) {
-                       usblp->used = 0;
+               if (usb_submit_urb(usblp->readurb, GFP_KERNEL) < 0)
                        return -EIO;
-               }
        }
 
        return 0;
@@ -412,6 +410,7 @@ static int usblp_open(struct inode *inode, struct file *file)
        usblp->readurb->status = 0;
 
        if (handle_bidir(usblp) < 0) {
+               usblp->used = 0;
                file->private_data = NULL;
                retval = -EIO;
        }