diff options
-rw-r--r-- | drivers/usb/storage/usb.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 255771151399..97b9ebb8a082 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -833,6 +833,19 @@ static void quiesce_and_remove_host(struct us_data *us) | |||
833 | /* Wait for the current command to finish, then remove the host */ | 833 | /* Wait for the current command to finish, then remove the host */ |
834 | down(&us->dev_semaphore); | 834 | down(&us->dev_semaphore); |
835 | up(&us->dev_semaphore); | 835 | up(&us->dev_semaphore); |
836 | |||
837 | /* queuecommand won't accept any new commands and the control | ||
838 | * thread won't execute a previously-queued command. If there | ||
839 | * is such a command pending, complete it with an error. */ | ||
840 | if (us->srb) { | ||
841 | us->srb->result = DID_NO_CONNECT << 16; | ||
842 | scsi_lock(us_to_host(us)); | ||
843 | us->srb->scsi_done(us->srb); | ||
844 | us->srb = NULL; | ||
845 | scsi_unlock(us_to_host(us)); | ||
846 | } | ||
847 | |||
848 | /* Now we own no commands so it's safe to remove the SCSI host */ | ||
836 | scsi_remove_host(us_to_host(us)); | 849 | scsi_remove_host(us_to_host(us)); |
837 | } | 850 | } |
838 | 851 | ||