|
@@ -326,14 +326,17 @@ static int stub_probe(struct usb_device *udev)
|
|
|
* See driver_probe_device() in driver/base/dd.c
|
|
* See driver_probe_device() in driver/base/dd.c
|
|
|
*/
|
|
*/
|
|
|
rc = -ENODEV;
|
|
rc = -ENODEV;
|
|
|
- goto sdev_free;
|
|
|
|
|
|
|
+ if (!busid_priv)
|
|
|
|
|
+ goto sdev_free;
|
|
|
|
|
+
|
|
|
|
|
+ goto call_put_busid_priv;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (udev->descriptor.bDeviceClass == USB_CLASS_HUB) {
|
|
if (udev->descriptor.bDeviceClass == USB_CLASS_HUB) {
|
|
|
dev_dbg(&udev->dev, "%s is a usb hub device... skip!\n",
|
|
dev_dbg(&udev->dev, "%s is a usb hub device... skip!\n",
|
|
|
udev_busid);
|
|
udev_busid);
|
|
|
rc = -ENODEV;
|
|
rc = -ENODEV;
|
|
|
- goto sdev_free;
|
|
|
|
|
|
|
+ goto call_put_busid_priv;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (!strcmp(udev->bus->bus_name, "vhci_hcd")) {
|
|
if (!strcmp(udev->bus->bus_name, "vhci_hcd")) {
|
|
@@ -342,7 +345,7 @@ static int stub_probe(struct usb_device *udev)
|
|
|
udev_busid);
|
|
udev_busid);
|
|
|
|
|
|
|
|
rc = -ENODEV;
|
|
rc = -ENODEV;
|
|
|
- goto sdev_free;
|
|
|
|
|
|
|
+ goto call_put_busid_priv;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -361,6 +364,9 @@ static int stub_probe(struct usb_device *udev)
|
|
|
save_status = busid_priv->status;
|
|
save_status = busid_priv->status;
|
|
|
busid_priv->status = STUB_BUSID_ALLOC;
|
|
busid_priv->status = STUB_BUSID_ALLOC;
|
|
|
|
|
|
|
|
|
|
+ /* release the busid_lock */
|
|
|
|
|
+ put_busid_priv(busid_priv);
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* Claim this hub port.
|
|
* Claim this hub port.
|
|
|
* It doesn't matter what value we pass as owner
|
|
* It doesn't matter what value we pass as owner
|
|
@@ -373,9 +379,6 @@ static int stub_probe(struct usb_device *udev)
|
|
|
goto err_port;
|
|
goto err_port;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /* release the busid_lock */
|
|
|
|
|
- put_busid_priv(busid_priv);
|
|
|
|
|
-
|
|
|
|
|
rc = stub_add_files(&udev->dev);
|
|
rc = stub_add_files(&udev->dev);
|
|
|
if (rc) {
|
|
if (rc) {
|
|
|
dev_err(&udev->dev, "stub_add_files for %s\n", udev_busid);
|
|
dev_err(&udev->dev, "stub_add_files for %s\n", udev_busid);
|
|
@@ -395,11 +398,17 @@ err_port:
|
|
|
spin_lock(&busid_priv->busid_lock);
|
|
spin_lock(&busid_priv->busid_lock);
|
|
|
busid_priv->sdev = NULL;
|
|
busid_priv->sdev = NULL;
|
|
|
busid_priv->status = save_status;
|
|
busid_priv->status = save_status;
|
|
|
-sdev_free:
|
|
|
|
|
- stub_device_free(sdev);
|
|
|
|
|
|
|
+ spin_unlock(&busid_priv->busid_lock);
|
|
|
|
|
+ /* lock is released - go to free */
|
|
|
|
|
+ goto sdev_free;
|
|
|
|
|
+
|
|
|
|
|
+call_put_busid_priv:
|
|
|
/* release the busid_lock */
|
|
/* release the busid_lock */
|
|
|
put_busid_priv(busid_priv);
|
|
put_busid_priv(busid_priv);
|
|
|
|
|
|
|
|
|
|
+sdev_free:
|
|
|
|
|
+ stub_device_free(sdev);
|
|
|
|
|
+
|
|
|
return rc;
|
|
return rc;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -435,7 +444,9 @@ static void stub_disconnect(struct usb_device *udev)
|
|
|
/* get stub_device */
|
|
/* get stub_device */
|
|
|
if (!sdev) {
|
|
if (!sdev) {
|
|
|
dev_err(&udev->dev, "could not get device");
|
|
dev_err(&udev->dev, "could not get device");
|
|
|
- goto call_put_busid_priv;
|
|
|
|
|
|
|
+ /* release busid_lock */
|
|
|
|
|
+ put_busid_priv(busid_priv);
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
dev_set_drvdata(&udev->dev, NULL);
|
|
dev_set_drvdata(&udev->dev, NULL);
|
|
@@ -465,7 +476,7 @@ static void stub_disconnect(struct usb_device *udev)
|
|
|
if (!busid_priv->shutdown_busid)
|
|
if (!busid_priv->shutdown_busid)
|
|
|
busid_priv->shutdown_busid = 1;
|
|
busid_priv->shutdown_busid = 1;
|
|
|
/* release busid_lock */
|
|
/* release busid_lock */
|
|
|
- put_busid_priv(busid_priv);
|
|
|
|
|
|
|
+ spin_unlock(&busid_priv->busid_lock);
|
|
|
|
|
|
|
|
/* shutdown the current connection */
|
|
/* shutdown the current connection */
|
|
|
shutdown_busid(busid_priv);
|
|
shutdown_busid(busid_priv);
|
|
@@ -480,10 +491,9 @@ static void stub_disconnect(struct usb_device *udev)
|
|
|
|
|
|
|
|
if (busid_priv->status == STUB_BUSID_ALLOC)
|
|
if (busid_priv->status == STUB_BUSID_ALLOC)
|
|
|
busid_priv->status = STUB_BUSID_ADDED;
|
|
busid_priv->status = STUB_BUSID_ADDED;
|
|
|
-
|
|
|
|
|
-call_put_busid_priv:
|
|
|
|
|
/* release busid_lock */
|
|
/* release busid_lock */
|
|
|
- put_busid_priv(busid_priv);
|
|
|
|
|
|
|
+ spin_unlock(&busid_priv->busid_lock);
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_PM
|
|
#ifdef CONFIG_PM
|