Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx> --- drivers/usb/storage/uas.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index d0e6703..3da185d 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c @@ -551,40 +551,39 @@ err: * daft to me. */ -static int uas_submit_sense_urb(struct Scsi_Host *shost, int size, - gfp_t gfp, unsigned int stream) +static struct urb *uas_submit_sense_urb(struct Scsi_Host *shost, int size, + gfp_t gfp, unsigned int stream) { struct uas_dev_info *devinfo = (void *)shost->hostdata[0]; struct urb *urb; urb = uas_alloc_sense_urb(devinfo, size, gfp, shost, stream); if (!urb) - return SCSI_MLQUEUE_DEVICE_BUSY; + return NULL; usb_anchor_urb(urb, &devinfo->sense_urbs); if (usb_submit_urb(urb, gfp)) { usb_unanchor_urb(urb); shost_printk(KERN_INFO, shost, "sense urb submission failure\n"); usb_free_urb(urb); - return SCSI_MLQUEUE_DEVICE_BUSY; + return NULL; } - return 0; + return urb; } static int uas_submit_urbs(struct scsi_cmnd *cmnd, struct uas_dev_info *devinfo, gfp_t gfp) { struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; - int err; + struct urb *urb; WARN_ON_ONCE(!spin_is_locked(&devinfo->lock)); if (cmdinfo->state & SUBMIT_STATUS_URB) { - err = uas_submit_sense_urb(cmnd->device->host, + urb = uas_submit_sense_urb(cmnd->device->host, sizeof(struct sense_iu), gfp, cmdinfo->stream); - if (err) { - return err; - } + if (!urb) + return SCSI_MLQUEUE_DEVICE_BUSY; cmdinfo->state &= ~SUBMIT_STATUS_URB; } @@ -728,13 +727,13 @@ static int uas_eh_task_mgmt(struct scsi_cmnd *cmnd, struct uas_dev_info *devinfo = (void *)shost->hostdata[0]; u16 tag = devinfo->qdepth; unsigned long flags; - int r; + struct urb *sense_urb; spin_lock_irqsave(&devinfo->lock, flags); memset(&devinfo->response, 0, sizeof(devinfo->response)); - r = uas_submit_sense_urb(shost, sizeof(struct response_iu), - GFP_ATOMIC, tag); - if (r != 0) { + sense_urb = uas_submit_sense_urb(shost, sizeof(struct response_iu), + GFP_ATOMIC, tag); + if (!sense_urb) { shost_printk(KERN_INFO, shost, "%s: %s: submit sense urb failed\n", __func__, fname); @@ -746,6 +745,7 @@ static int uas_eh_task_mgmt(struct scsi_cmnd *cmnd, "%s: %s: submit task mgmt urb failed\n", __func__, fname); spin_unlock_irqrestore(&devinfo->lock, flags); + usb_kill_urb(sense_urb); return FAILED; } spin_unlock_irqrestore(&devinfo->lock, flags); -- 1.8.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html