aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/hv
diff options
context:
space:
mode:
authorBill Pemberton <wfp5p@virginia.edu>2010-05-05 15:27:33 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-11 11:36:13 -0700
commit80d11b2ae26543656f7226b44ed9d6a184766e85 (patch)
treea5eba69fbddf85565eb4fc8d7a1b4276a014340a /drivers/staging/hv
parent8cad0af9a1a1882cd00f12f8f7c79690f563b1d7 (diff)
Staging: hv: test return value of osd_WaitEventCreate()
The return value of osd_WaitEventCreate() was not examined in some places. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hank Janssen <hjanssen@microsoft.com> Cc: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/hv')
-rw-r--r--drivers/staging/hv/Connection.c5
-rw-r--r--drivers/staging/hv/NetVsc.c4
-rw-r--r--drivers/staging/hv/StorVsc.c10
3 files changed, 18 insertions, 1 deletions
diff --git a/drivers/staging/hv/Connection.c b/drivers/staging/hv/Connection.c
index 1e4111412ab..e590eb4b6e7 100644
--- a/drivers/staging/hv/Connection.c
+++ b/drivers/staging/hv/Connection.c
@@ -98,6 +98,11 @@ int VmbusConnect(void)
}
msgInfo->WaitEvent = osd_WaitEventCreate();
+ if (!msgInfo->WaitEvent) {
+ ret = -ENOMEM;
+ goto Cleanup;
+ }
+
msg = (struct vmbus_channel_initiate_contact *)msgInfo->Msg;
msg->Header.MessageType = ChannelMessageInitiateContact;
diff --git a/drivers/staging/hv/NetVsc.c b/drivers/staging/hv/NetVsc.c
index 27516d40b6e..d3154e71177 100644
--- a/drivers/staging/hv/NetVsc.c
+++ b/drivers/staging/hv/NetVsc.c
@@ -749,6 +749,10 @@ static int NetVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo)
&netDevice->ReceivePacketList);
}
netDevice->ChannelInitEvent = osd_WaitEventCreate();
+ if (!netDevice->ChannelInitEvent) {
+ ret = -ENOMEM;
+ goto Cleanup;
+ }
/* Open the channel */
ret = Device->Driver->VmbusChannelInterface.Open(Device,
diff --git a/drivers/staging/hv/StorVsc.c b/drivers/staging/hv/StorVsc.c
index 7372317fe83..4d0fbce229e 100644
--- a/drivers/staging/hv/StorVsc.c
+++ b/drivers/staging/hv/StorVsc.c
@@ -199,6 +199,10 @@ static int StorVscChannelInit(struct hv_device *Device)
*/
memset(request, 0, sizeof(struct storvsc_request_extension));
request->WaitEvent = osd_WaitEventCreate();
+ if (!request->WaitEvent) {
+ ret = -ENOMEM;
+ goto nomem;
+ }
vstorPacket->Operation = VStorOperationBeginInitialization;
vstorPacket->Flags = REQUEST_COMPLETION_FLAG;
@@ -338,7 +342,7 @@ static int StorVscChannelInit(struct hv_device *Device)
Cleanup:
kfree(request->WaitEvent);
request->WaitEvent = NULL;
-
+nomem:
PutStorDevice(Device);
DPRINT_EXIT(STORVSC);
@@ -649,6 +653,10 @@ int StorVscOnHostReset(struct hv_device *Device)
vstorPacket = &request->VStorPacket;
request->WaitEvent = osd_WaitEventCreate();
+ if (!request->WaitEvent) {
+ ret = -ENOMEM;
+ goto Cleanup;
+ }
vstorPacket->Operation = VStorOperationResetBus;
vstorPacket->Flags = REQUEST_COMPLETION_FLAG;