storvsc: Set the error code correctly in failure conditions
authorK. Y. Srinivasan <kys@microsoft.com>
Thu, 13 Aug 2015 15:43:52 +0000 (08:43 -0700)
committerJames Bottomley <JBottomley@Odin.com>
Thu, 27 Aug 2015 05:41:36 +0000 (22:41 -0700)
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 <kys@microsoft.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
drivers/scsi/storvsc_drv.c

index cbb1bd1e020c4b3e141a2b2ac8744d221c5c9d5e..40c43aeb4ff364898f160d7528d93ea4ef46a00a 100644 (file)
@@ -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++) {
@@ -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.
@@ -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);