usb: storage: fix runtime pm issue in usb_stor_probe2
[deliverable/linux.git] / drivers / usb / storage / usb.c
index ef2d8cde6ef700bda2e97b6d9fbce99e9be0c872..8c5f0115166ab0bf3761357d4d5a466409a6896d 100644 (file)
@@ -1070,17 +1070,17 @@ int usb_stor_probe2(struct us_data *us)
        result = usb_stor_acquire_resources(us);
        if (result)
                goto BadDevice;
+       usb_autopm_get_interface_no_resume(us->pusb_intf);
        snprintf(us->scsi_name, sizeof(us->scsi_name), "usb-storage %s",
                                        dev_name(&us->pusb_intf->dev));
        result = scsi_add_host(us_to_host(us), dev);
        if (result) {
                dev_warn(dev,
                                "Unable to add the scsi host\n");
-               goto BadDevice;
+               goto HostAddErr;
        }
 
        /* Submit the delayed_work for SCSI-device scanning */
-       usb_autopm_get_interface_no_resume(us->pusb_intf);
        set_bit(US_FLIDX_SCAN_PENDING, &us->dflags);
 
        if (delay_use > 0)
@@ -1090,6 +1090,8 @@ int usb_stor_probe2(struct us_data *us)
        return 0;
 
        /* We come here if there are any problems */
+HostAddErr:
+       usb_autopm_put_interface_no_suspend(us->pusb_intf);
 BadDevice:
        usb_stor_dbg(us, "storage_probe() failed\n");
        release_everything(us);
This page took 0.025331 seconds and 5 git commands to generate.