Skip to content

Commit

Permalink
storvsc: Set the error code correctly in failure conditions
Browse files Browse the repository at this point in the history
In the function storvsc_channel_init(), error code was not getting
set correctly in some of the failure cases. Fix this issue.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
  • Loading branch information
kattisrinivasan authored and James Bottomley committed Aug 27, 2015
1 parent b95f5be commit 111f2d1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions drivers/scsi/storvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -952,8 +952,10 @@ static int storvsc_channel_init(struct hv_device *device)
}

if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO ||
vstor_packet->status != 0)
vstor_packet->status != 0) {
ret = -EINVAL;
goto cleanup;
}


for (i = 0; i < ARRAY_SIZE(vmstor_protocols); i++) {
Expand Down Expand Up @@ -1032,8 +1034,10 @@ static int storvsc_channel_init(struct hv_device *device)
}

if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO ||
vstor_packet->status != 0)
vstor_packet->status != 0) {
ret = -EINVAL;
goto cleanup;
}

/*
* Check to see if multi-channel support is there.
Expand Down Expand Up @@ -1070,8 +1074,10 @@ static int storvsc_channel_init(struct hv_device *device)
}

if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO ||
vstor_packet->status != 0)
vstor_packet->status != 0) {
ret = -EINVAL;
goto cleanup;
}

if (process_sub_channels)
handle_multichannel_storage(device, max_chns);
Expand Down

0 comments on commit 111f2d1

Please sign in to comment.