Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 104617
b: refs/heads/master
c: d64aac3
h: refs/heads/master
i:
  104615: 3f8b4e7
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Jul 21, 2008
1 parent 3030945 commit 04769eb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 61ad04a89f0e3e6adaed0d9adfc0c9b431ccbb92
refs/heads/master: d64aac36394b3c26db53538bfedd8444a3a2206e
16 changes: 11 additions & 5 deletions trunk/drivers/usb/core/devio.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,6 @@ static struct usb_device *usbdev_lookup_by_devt(dev_t devt)
dev = bus_find_device(&usb_bus_type, NULL, (void *) devt, match_devt);
if (!dev)
return NULL;
put_device(dev);
return container_of(dev, struct usb_device, dev);
}

Expand Down Expand Up @@ -591,16 +590,21 @@ static int usbdev_open(struct inode *inode, struct file *file)
dev = usbdev_lookup_by_devt(inode->i_rdev);
#ifdef CONFIG_USB_DEVICEFS
/* procfs file */
if (!dev)
if (!dev) {
dev = inode->i_private;
if (dev && dev->usbfs_dentry &&
dev->usbfs_dentry->d_inode == inode)
usb_get_dev(dev);
else
dev = NULL;
}
#endif
if (!dev)
if (!dev || dev->state == USB_STATE_NOTATTACHED)
goto out;
ret = usb_autoresume_device(dev);
if (ret)
goto out;

usb_get_dev(dev);
ret = 0;
ps->dev = dev;
ps->file = file;
Expand All @@ -620,8 +624,10 @@ static int usbdev_open(struct inode *inode, struct file *file)
list_add_tail(&ps->list, &dev->filelist);
file->private_data = ps;
out:
if (ret)
if (ret) {
kfree(ps);
usb_put_dev(dev);
}
mutex_unlock(&usbfs_mutex);
unlock_kernel();
return ret;
Expand Down

0 comments on commit 04769eb

Please sign in to comment.