From ba8c0b6bbd433b56f0ecfe5afedcc2a0776300e7 Mon Sep 17 00:00:00 2001 From: Bingxing Wang Date: Mon, 5 Aug 2019 15:38:27 -0700 Subject: [PATCH] USB: attach memory pool tag for control transfer --- src/AmtPtpDeviceUsbKm/Device.c | 3 ++- src/AmtPtpDeviceUsbKm/Device.h | 5 +++++ src/AmtPtpDeviceUsbUm/Device.c | 8 ++++---- src/AmtPtpDeviceUsbUm/Device.h | 5 +++++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/AmtPtpDeviceUsbKm/Device.c b/src/AmtPtpDeviceUsbKm/Device.c index 177e00b..3647ee7 100644 --- a/src/AmtPtpDeviceUsbKm/Device.c +++ b/src/AmtPtpDeviceUsbKm/Device.c @@ -523,7 +523,7 @@ AmtPtpSetWellspringMode( status = WdfMemoryCreate( WDF_NO_OBJECT_ATTRIBUTES, PagedPool, - 0, + POOL_TAG_PTP_CONTROL, DeviceContext->DeviceInfo->um_size, &bufHandle, &buffer @@ -626,6 +626,7 @@ AmtPtpSetWellspringMode( "%!FUNC! Exit" ); + WdfObjectDelete(bufHandle); bufHandle = NULL; return status; } diff --git a/src/AmtPtpDeviceUsbKm/Device.h b/src/AmtPtpDeviceUsbKm/Device.h index b372cb0..6ea2f38 100644 --- a/src/AmtPtpDeviceUsbKm/Device.h +++ b/src/AmtPtpDeviceUsbKm/Device.h @@ -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 // diff --git a/src/AmtPtpDeviceUsbUm/Device.c b/src/AmtPtpDeviceUsbUm/Device.c index 2bb5f1c..27284dc 100644 --- a/src/AmtPtpDeviceUsbUm/Device.c +++ b/src/AmtPtpDeviceUsbUm/Device.c @@ -340,7 +340,7 @@ AmtPtpGetWellspringMode( status = WdfMemoryCreate( WDF_NO_OBJECT_ATTRIBUTES, PagedPool, - 0, + POOL_TAG_PTP_CONTROL, DeviceContext->DeviceInfo->um_size, &bufHandle, &buffer @@ -407,7 +407,7 @@ AmtPtpGetWellspringMode( "%!FUNC! Exit" ); - bufHandle = NULL; + WdfObjectDelete(bufHandle); return status; } @@ -443,7 +443,7 @@ AmtPtpSetWellspringMode( status = WdfMemoryCreate( WDF_NO_OBJECT_ATTRIBUTES, PagedPool, - 0, + POOL_TAG_PTP_CONTROL, DeviceContext->DeviceInfo->um_size, &bufHandle, &buffer @@ -546,7 +546,7 @@ AmtPtpSetWellspringMode( "%!FUNC! Exit" ); - bufHandle = NULL; + WdfObjectDelete(bufHandle); return status; } diff --git a/src/AmtPtpDeviceUsbUm/Device.h b/src/AmtPtpDeviceUsbUm/Device.h index 68d191d..837ee72 100644 --- a/src/AmtPtpDeviceUsbUm/Device.h +++ b/src/AmtPtpDeviceUsbUm/Device.h @@ -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 //