summaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2012-09-26 10:29:03 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-26 23:13:19 +0200
commite0423dee897734576cf4cc021165dd4521e9d3cc (patch)
treeccc122d0cd142c68fdaea1545ddf56b17f54ce52 /drivers/usb/storage
parentUSB: uas: fix locking (diff)
downloadlinux-e0423dee897734576cf4cc021165dd4521e9d3cc.tar.xz
linux-e0423dee897734576cf4cc021165dd4521e9d3cc.zip
USB: uas: fix gcc warning
Streamline control flow so it is easier for gcc to follow which paths can be taken and which can't. Fixes "warning: 'cmdinfo' may be used uninitialized in this function" Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r--drivers/usb/storage/uas.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 4218701bb45e..98b98eef7527 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -249,16 +249,18 @@ static void uas_stat_cmplt(struct urb *urb)
cmnd = devinfo->cmnd;
else
cmnd = scsi_host_find_tag(shost, tag - 1);
+
if (!cmnd) {
- if (iu->iu_id != IU_ID_RESPONSE) {
- usb_free_urb(urb);
- spin_unlock_irqrestore(&devinfo->lock, flags);
- return;
+ if (iu->iu_id == IU_ID_RESPONSE) {
+ /* store results for uas_eh_task_mgmt() */
+ memcpy(&devinfo->response, iu, sizeof(devinfo->response));
}
- } else {
- cmdinfo = (void *)&cmnd->SCp;
+ usb_free_urb(urb);
+ spin_unlock_irqrestore(&devinfo->lock, flags);
+ return;
}
+ cmdinfo = (void *)&cmnd->SCp;
switch (iu->iu_id) {
case IU_ID_STATUS:
if (devinfo->cmnd == cmnd)
@@ -292,10 +294,6 @@ static void uas_stat_cmplt(struct urb *urb)
case IU_ID_WRITE_READY:
uas_xfer_data(urb, cmnd, SUBMIT_DATA_OUT_URB);
break;
- case IU_ID_RESPONSE:
- /* store results for uas_eh_task_mgmt() */
- memcpy(&devinfo->response, iu, sizeof(devinfo->response));
- break;
default:
scmd_printk(KERN_ERR, cmnd,
"Bogus IU (%d) received on status pipe\n", iu->iu_id);