From 166f26af89991451969181c74c61350f4ee88968 Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Mon, 11 Jan 2010 08:36:12 +0000 Subject: [PATCH] [usb/usbehci] - EhciDefferedRoutine: Fix late night brain fart by filling the members of the WorkItemData before queuing the work item. svn path=/trunk/; revision=45043 --- reactos/drivers/usb/usbehci/fdo.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/reactos/drivers/usb/usbehci/fdo.c b/reactos/drivers/usb/usbehci/fdo.c index 73feb442968..5435f7260c7 100644 --- a/reactos/drivers/usb/usbehci/fdo.c +++ b/reactos/drivers/usb/usbehci/fdo.c @@ -39,7 +39,6 @@ EhciDefferedRoutine(PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVO /* Check for port change on this port */ if (tmp & 0x02) { - PIO_WORKITEM WorkItem = NULL; PWORKITEM_DATA WorkItemData = NULL; /* Connect or Disconnect? */ @@ -86,13 +85,6 @@ EhciDefferedRoutine(PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVO FdoDeviceExtension->ChildDeviceCount++; CompletePendingRequest(FdoDeviceExtension); - WorkItem = IoAllocateWorkItem(FdoDeviceExtension->Pdo); - if (!WorkItem) - { - DPRINT1("WorkItem allocation failed!\n"); - break; - } - WorkItemData = ExAllocatePool(NonPagedPool, sizeof(WORKITEM_DATA)); if (!WorkItemData) { @@ -100,7 +92,17 @@ EhciDefferedRoutine(PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVO break; } - IoQueueWorkItem(WorkItem, + WorkItemData->IoWorkItem = IoAllocateWorkItem(FdoDeviceExtension->Pdo); + if (!WorkItemData->IoWorkItem) + { + DPRINT1("WorkItem allocation failed!\n"); + break; + } + + + WorkItemData->FdoDeviceExtension = FdoDeviceExtension; + + IoQueueWorkItem(WorkItemData->IoWorkItem, (PIO_WORKITEM_ROUTINE)DeviceArrivalWorkItem, DelayedWorkQueue, WorkItemData);