diff options
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/usbip/vhci_hcd.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index 08bd26a245d5..5f1e2b0a628a 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c | |||
@@ -607,7 +607,9 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
607 | dev_info(dev, "SetAddress Request (%d) to port %d\n", | 607 | dev_info(dev, "SetAddress Request (%d) to port %d\n", |
608 | ctrlreq->wValue, vdev->rhport); | 608 | ctrlreq->wValue, vdev->rhport); |
609 | 609 | ||
610 | vdev->udev = urb->dev; | 610 | if (vdev->udev) |
611 | usb_put_dev(vdev->udev); | ||
612 | vdev->udev = usb_get_dev(urb->dev); | ||
611 | 613 | ||
612 | spin_lock(&vdev->ud.lock); | 614 | spin_lock(&vdev->ud.lock); |
613 | vdev->ud.status = VDEV_ST_USED; | 615 | vdev->ud.status = VDEV_ST_USED; |
@@ -627,8 +629,9 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
627 | "Get_Descriptor to device 0 " | 629 | "Get_Descriptor to device 0 " |
628 | "(get max pipe size)\n"); | 630 | "(get max pipe size)\n"); |
629 | 631 | ||
630 | /* FIXME: reference count? (usb_get_dev()) */ | 632 | if (vdev->udev) |
631 | vdev->udev = urb->dev; | 633 | usb_put_dev(vdev->udev); |
634 | vdev->udev = usb_get_dev(urb->dev); | ||
632 | goto out; | 635 | goto out; |
633 | 636 | ||
634 | default: | 637 | default: |
@@ -887,6 +890,10 @@ static void vhci_device_reset(struct usbip_device *ud) | |||
887 | vdev->speed = 0; | 890 | vdev->speed = 0; |
888 | vdev->devid = 0; | 891 | vdev->devid = 0; |
889 | 892 | ||
893 | if (vdev->udev) | ||
894 | usb_put_dev(vdev->udev); | ||
895 | vdev->udev = NULL; | ||
896 | |||
890 | ud->tcp_socket = NULL; | 897 | ud->tcp_socket = NULL; |
891 | 898 | ||
892 | ud->status = VDEV_ST_NULL; | 899 | ud->status = VDEV_ST_NULL; |