Commit a00e8224 authored by K. Y. Srinivasan's avatar K. Y. Srinivasan Committed by Greg Kroah-Hartman

Staging: hv: storvsc: Fix error handling storvsc_host_reset()

Fix error handling storvsc_host_reset(). I would like to thank
Long Li <longli@microsoft.com> for reporting this.
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Reported-by: default avatarLong Li <longli@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 59e00e74
...@@ -1019,7 +1019,7 @@ static int storvsc_host_reset(struct hv_device *device) ...@@ -1019,7 +1019,7 @@ static int storvsc_host_reset(struct hv_device *device)
stor_device = get_out_stor_device(device); stor_device = get_out_stor_device(device);
if (!stor_device) if (!stor_device)
return -ENODEV; return FAILED;
request = &stor_device->reset_request; request = &stor_device->reset_request;
vstor_packet = &request->vstor_packet; vstor_packet = &request->vstor_packet;
...@@ -1036,13 +1036,11 @@ static int storvsc_host_reset(struct hv_device *device) ...@@ -1036,13 +1036,11 @@ static int storvsc_host_reset(struct hv_device *device)
VM_PKT_DATA_INBAND, VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) if (ret != 0)
goto cleanup; return FAILED;
t = wait_for_completion_timeout(&request->wait_event, 5*HZ); t = wait_for_completion_timeout(&request->wait_event, 5*HZ);
if (t == 0) { if (t == 0)
ret = -ETIMEDOUT; return TIMEOUT_ERROR;
goto cleanup;
}
/* /*
...@@ -1050,8 +1048,7 @@ static int storvsc_host_reset(struct hv_device *device) ...@@ -1050,8 +1048,7 @@ static int storvsc_host_reset(struct hv_device *device)
* should have been flushed out and return to us * should have been flushed out and return to us
*/ */
cleanup: return SUCCESS;
return ret;
} }
...@@ -1060,16 +1057,11 @@ static int storvsc_host_reset(struct hv_device *device) ...@@ -1060,16 +1057,11 @@ static int storvsc_host_reset(struct hv_device *device)
*/ */
static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd) static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
{ {
int ret;
struct hv_host_device *host_dev = struct hv_host_device *host_dev =
(struct hv_host_device *)scmnd->device->host->hostdata; (struct hv_host_device *)scmnd->device->host->hostdata;
struct hv_device *dev = host_dev->dev; struct hv_device *dev = host_dev->dev;
ret = storvsc_host_reset(dev); return storvsc_host_reset(dev);
if (ret != 0)
return ret;
return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment