diff options
-rw-r--r-- | drivers/usb/usbip/stub_dev.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c index fac20e0434c0..a3ec49bdc1e6 100644 --- a/drivers/usb/usbip/stub_dev.c +++ b/drivers/usb/usbip/stub_dev.c | |||
@@ -311,7 +311,6 @@ static int stub_probe(struct usb_device *udev) | |||
311 | { | 311 | { |
312 | struct stub_device *sdev = NULL; | 312 | struct stub_device *sdev = NULL; |
313 | const char *udev_busid = dev_name(&udev->dev); | 313 | const char *udev_busid = dev_name(&udev->dev); |
314 | int err = 0; | ||
315 | struct bus_id_priv *busid_priv; | 314 | struct bus_id_priv *busid_priv; |
316 | int rc; | 315 | int rc; |
317 | 316 | ||
@@ -372,23 +371,28 @@ static int stub_probe(struct usb_device *udev) | |||
372 | (struct usb_dev_state *) udev); | 371 | (struct usb_dev_state *) udev); |
373 | if (rc) { | 372 | if (rc) { |
374 | dev_dbg(&udev->dev, "unable to claim port\n"); | 373 | dev_dbg(&udev->dev, "unable to claim port\n"); |
375 | return rc; | 374 | goto err_port; |
376 | } | 375 | } |
377 | 376 | ||
378 | err = stub_add_files(&udev->dev); | 377 | rc = stub_add_files(&udev->dev); |
379 | if (err) { | 378 | if (rc) { |
380 | dev_err(&udev->dev, "stub_add_files for %s\n", udev_busid); | 379 | dev_err(&udev->dev, "stub_add_files for %s\n", udev_busid); |
381 | dev_set_drvdata(&udev->dev, NULL); | 380 | goto err_files; |
382 | usb_put_dev(udev); | ||
383 | kthread_stop_put(sdev->ud.eh); | ||
384 | |||
385 | busid_priv->sdev = NULL; | ||
386 | stub_device_free(sdev); | ||
387 | return err; | ||
388 | } | 381 | } |
389 | busid_priv->status = STUB_BUSID_ALLOC; | 382 | busid_priv->status = STUB_BUSID_ALLOC; |
390 | 383 | ||
391 | return 0; | 384 | return 0; |
385 | err_files: | ||
386 | usb_hub_release_port(udev->parent, udev->portnum, | ||
387 | (struct usb_dev_state *) udev); | ||
388 | err_port: | ||
389 | dev_set_drvdata(&udev->dev, NULL); | ||
390 | usb_put_dev(udev); | ||
391 | kthread_stop_put(sdev->ud.eh); | ||
392 | |||
393 | busid_priv->sdev = NULL; | ||
394 | stub_device_free(sdev); | ||
395 | return rc; | ||
392 | } | 396 | } |
393 | 397 | ||
394 | static void shutdown_busid(struct bus_id_priv *busid_priv) | 398 | static void shutdown_busid(struct bus_id_priv *busid_priv) |