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

Staging: hv: storvsc: Cleanup error handling in storvsc_dev_add()

Use standard Linux error values and cleanup error handling. I would like
to acknowledge Andre Bartke (andre.bartke@gmail.com) for highlighting this
problem.
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5289d3d1
...@@ -392,10 +392,8 @@ int storvsc_dev_add(struct hv_device *device, ...@@ -392,10 +392,8 @@ int storvsc_dev_add(struct hv_device *device,
device_info = (struct storvsc_device_info *)additional_info; device_info = (struct storvsc_device_info *)additional_info;
stor_device = alloc_stor_device(device); stor_device = alloc_stor_device(device);
if (!stor_device) { if (!stor_device)
ret = -1; return -ENOMEM;
goto cleanup;
}
/* Save the channel properties to our storvsc channel */ /* Save the channel properties to our storvsc channel */
...@@ -409,11 +407,13 @@ int storvsc_dev_add(struct hv_device *device, ...@@ -409,11 +407,13 @@ int storvsc_dev_add(struct hv_device *device,
stor_device->port_number = device_info->port_number; stor_device->port_number = device_info->port_number;
/* Send it back up */ /* Send it back up */
ret = storvsc_connect_to_vsp(device, device_info->ring_buffer_size); ret = storvsc_connect_to_vsp(device, device_info->ring_buffer_size);
if (ret) {
free_stor_device(stor_device);
return ret;
}
device_info->path_id = stor_device->path_id; device_info->path_id = stor_device->path_id;
device_info->target_id = stor_device->target_id; device_info->target_id = stor_device->target_id;
cleanup:
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