mirror of
https://github.com/reactos/reactos.git
synced 2024-08-21 02:43:48 +00:00
[usb/usbehci]
- Fix WorkItem Context to pass in Device Extension and the IoWorkItem so it may be freed. svn path=/trunk/; revision=45024
This commit is contained in:
parent
72ed9b6854
commit
433baa7b5e
|
@ -40,6 +40,7 @@ EhciDefferedRoutine(PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVO
|
|||
if (tmp & 0x02)
|
||||
{
|
||||
PIO_WORKITEM WorkItem = NULL;
|
||||
PWORKITEM_DATA WorkItemData = NULL;
|
||||
|
||||
/* Connect or Disconnect? */
|
||||
if (tmp & 0x01)
|
||||
|
@ -86,16 +87,23 @@ EhciDefferedRoutine(PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVO
|
|||
CompletePendingRequest(FdoDeviceExtension);
|
||||
|
||||
WorkItem = IoAllocateWorkItem(FdoDeviceExtension->Pdo);
|
||||
|
||||
if (!WorkItem)
|
||||
{
|
||||
DPRINT1("WorkItem allocation failed!\n");
|
||||
break;
|
||||
}
|
||||
|
||||
WorkItemData = ExAllocatePool(NonPagedPool, sizeof(WORKITEM_DATA));
|
||||
if (!WorkItemData)
|
||||
{
|
||||
DPRINT1("No memory\n");
|
||||
break;
|
||||
}
|
||||
|
||||
IoQueueWorkItem(WorkItem,
|
||||
(PIO_WORKITEM_ROUTINE)DeviceArrivalWorkItem,
|
||||
DelayedWorkQueue,
|
||||
FdoDeviceExtension);
|
||||
WorkItemData);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -107,25 +107,26 @@ ArrivalNotificationCompletion(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID PCont
|
|||
VOID
|
||||
DeviceArrivalWorkItem(PDEVICE_OBJECT DeviceObject, PVOID Context)
|
||||
{
|
||||
PFDO_DEVICE_EXTENSION FdoDeviceExtension;
|
||||
PWORKITEM_DATA WorkItemData;
|
||||
PIO_STACK_LOCATION IrpStack = NULL;
|
||||
PDEVICE_OBJECT PortDeviceObject = NULL;
|
||||
PIRP Irp = NULL;
|
||||
|
||||
FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)Context;
|
||||
WorkItemData = (PWORKITEM_DATA)Context;
|
||||
|
||||
PortDeviceObject = IoGetAttachedDeviceReference(FdoDeviceExtension->Pdo);
|
||||
PortDeviceObject = IoGetAttachedDeviceReference(WorkItemData->FdoDeviceExtension->Pdo);
|
||||
|
||||
if (!PortDeviceObject)
|
||||
{
|
||||
DPRINT1("Unable to notify Pdos parent of device arrival.\n");
|
||||
return;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if (PortDeviceObject == DeviceObject)
|
||||
{
|
||||
/* Piontless to send query relations to ourself */
|
||||
ObDereferenceObject(PortDeviceObject);
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
Irp = IoAllocateIrp(PortDeviceObject->StackSize, FALSE);
|
||||
|
@ -148,5 +149,9 @@ DeviceArrivalWorkItem(PDEVICE_OBJECT DeviceObject, PVOID Context)
|
|||
IrpStack->MinorFunction = IRP_MN_QUERY_DEVICE_RELATIONS;
|
||||
|
||||
IoCallDriver(PortDeviceObject, Irp);
|
||||
|
||||
Cleanup:
|
||||
IoFreeWorkItem(WorkItemData->IoWorkItem);
|
||||
ExFreePool(WorkItemData);
|
||||
}
|
||||
|
||||
|
|
|
@ -366,6 +366,12 @@ typedef struct _PDO_DEVICE_EXTENSION
|
|||
} PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;
|
||||
|
||||
|
||||
typedef struct _WORKITEM_DATA
|
||||
{
|
||||
PIO_WORKITEM IoWorkItem;
|
||||
PFDO_DEVICE_EXTENSION FdoDeviceExtension;
|
||||
} WORKITEM_DATA, *PWORKITEM_DATA;
|
||||
|
||||
NTSTATUS NTAPI
|
||||
GetBusInterface(PDEVICE_OBJECT pcifido, PBUS_INTERFACE_STANDARD busInterface);
|
||||
|
||||
|
|
Loading…
Reference in a new issue