diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2012-09-26 04:29:03 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-26 17:13:19 -0400 |
commit | e0423dee897734576cf4cc021165dd4521e9d3cc (patch) | |
tree | ccc122d0cd142c68fdaea1545ddf56b17f54ce52 /drivers/usb | |
parent | 1994ff405e9c1a8916ca41e093e786262af42b42 (diff) |
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')
-rw-r--r-- | drivers/usb/storage/uas.c | 18 |
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) | |||
249 | cmnd = devinfo->cmnd; | 249 | cmnd = devinfo->cmnd; |
250 | else | 250 | else |
251 | cmnd = scsi_host_find_tag(shost, tag - 1); | 251 | cmnd = scsi_host_find_tag(shost, tag - 1); |
252 | |||
252 | if (!cmnd) { | 253 | if (!cmnd) { |
253 | if (iu->iu_id != IU_ID_RESPONSE) { | 254 | if (iu->iu_id == IU_ID_RESPONSE) { |
254 | usb_free_urb(urb); | 255 | /* store results for uas_eh_task_mgmt() */ |
255 | spin_unlock_irqrestore(&devinfo->lock, flags); | 256 | memcpy(&devinfo->response, iu, sizeof(devinfo->response)); |
256 | return; | ||
257 | } | 257 | } |
258 | } else { | 258 | usb_free_urb(urb); |
259 | cmdinfo = (void *)&cmnd->SCp; | 259 | spin_unlock_irqrestore(&devinfo->lock, flags); |
260 | return; | ||
260 | } | 261 | } |
261 | 262 | ||
263 | cmdinfo = (void *)&cmnd->SCp; | ||
262 | switch (iu->iu_id) { | 264 | switch (iu->iu_id) { |
263 | case IU_ID_STATUS: | 265 | case IU_ID_STATUS: |
264 | if (devinfo->cmnd == cmnd) | 266 | if (devinfo->cmnd == cmnd) |
@@ -292,10 +294,6 @@ static void uas_stat_cmplt(struct urb *urb) | |||
292 | case IU_ID_WRITE_READY: | 294 | case IU_ID_WRITE_READY: |
293 | uas_xfer_data(urb, cmnd, SUBMIT_DATA_OUT_URB); | 295 | uas_xfer_data(urb, cmnd, SUBMIT_DATA_OUT_URB); |
294 | break; | 296 | break; |
295 | case IU_ID_RESPONSE: | ||
296 | /* store results for uas_eh_task_mgmt() */ | ||
297 | memcpy(&devinfo->response, iu, sizeof(devinfo->response)); | ||
298 | break; | ||
299 | default: | 297 | default: |
300 | scmd_printk(KERN_ERR, cmnd, | 298 | scmd_printk(KERN_ERR, cmnd, |
301 | "Bogus IU (%d) received on status pipe\n", iu->iu_id); | 299 | "Bogus IU (%d) received on status pipe\n", iu->iu_id); |