Skip to content

Commit

Permalink
USB: attach memory pool tag for control transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
Bingxing Wang committed Aug 5, 2019
1 parent 1a88b18 commit ba8c0b6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/AmtPtpDeviceUsbKm/Device.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ AmtPtpSetWellspringMode(
status = WdfMemoryCreate(
WDF_NO_OBJECT_ATTRIBUTES,
PagedPool,
0,
POOL_TAG_PTP_CONTROL,
DeviceContext->DeviceInfo->um_size,
&bufHandle,
&buffer
Expand Down Expand Up @@ -626,6 +626,7 @@ AmtPtpSetWellspringMode(
"%!FUNC! Exit"
);

WdfObjectDelete(bufHandle);
bufHandle = NULL;
return status;
}
5 changes: 5 additions & 0 deletions src/AmtPtpDeviceUsbKm/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ typedef struct _DEVICE_CONTEXT
//
WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DEVICE_CONTEXT, DeviceGetContext)

//
// Pool tags
//
#define POOL_TAG_PTP_CONTROL 'PTPC'

//
// Function to initialize the device's queues and callbacks
//
Expand Down
8 changes: 4 additions & 4 deletions src/AmtPtpDeviceUsbUm/Device.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ AmtPtpGetWellspringMode(
status = WdfMemoryCreate(
WDF_NO_OBJECT_ATTRIBUTES,
PagedPool,
0,
POOL_TAG_PTP_CONTROL,
DeviceContext->DeviceInfo->um_size,
&bufHandle,
&buffer
Expand Down Expand Up @@ -407,7 +407,7 @@ AmtPtpGetWellspringMode(
"%!FUNC! Exit"
);

bufHandle = NULL;
WdfObjectDelete(bufHandle);
return status;

}
Expand Down Expand Up @@ -443,7 +443,7 @@ AmtPtpSetWellspringMode(
status = WdfMemoryCreate(
WDF_NO_OBJECT_ATTRIBUTES,
PagedPool,
0,
POOL_TAG_PTP_CONTROL,
DeviceContext->DeviceInfo->um_size,
&bufHandle,
&buffer
Expand Down Expand Up @@ -546,7 +546,7 @@ AmtPtpSetWellspringMode(
"%!FUNC! Exit"
);

bufHandle = NULL;
WdfObjectDelete(bufHandle);
return status;

}
Expand Down
5 changes: 5 additions & 0 deletions src/AmtPtpDeviceUsbUm/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ typedef struct _DEVICE_CONTEXT
//
WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DEVICE_CONTEXT, DeviceGetContext)

//
// Pool tags
//
#define POOL_TAG_PTP_CONTROL 'PTPC'

//
// Function to initialize the device's queues and callbacks
//
Expand Down

0 comments on commit ba8c0b6

Please sign in to comment.