Author: mjmartin
Date: Sun Jan 10 13:24:01 2010
New Revision: 45024
URL:
http://svn.reactos.org/svn/reactos?rev=45024&view=rev
Log:
[usb/usbehci]
- Fix WorkItem Context to pass in Device Extension and the IoWorkItem so it may be freed.
Modified:
trunk/reactos/drivers/usb/usbehci/fdo.c
trunk/reactos/drivers/usb/usbehci/irp.c
trunk/reactos/drivers/usb/usbehci/usbehci.h
Modified: trunk/reactos/drivers/usb/usbehci/fdo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/fdo.c?…
==============================================================================
--- trunk/reactos/drivers/usb/usbehci/fdo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbehci/fdo.c [iso-8859-1] Sun Jan 10 13:24:01 2010
@@ -40,6 +40,7 @@
if (tmp & 0x02)
{
PIO_WORKITEM WorkItem = NULL;
+ PWORKITEM_DATA WorkItemData = NULL;
/* Connect or Disconnect? */
if (tmp & 0x01)
@@ -86,16 +87,23 @@
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
{
Modified: trunk/reactos/drivers/usb/usbehci/irp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/irp.c?…
==============================================================================
--- trunk/reactos/drivers/usb/usbehci/irp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbehci/irp.c [iso-8859-1] Sun Jan 10 13:24:01 2010
@@ -107,25 +107,26 @@
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 @@
IrpStack->MinorFunction = IRP_MN_QUERY_DEVICE_RELATIONS;
IoCallDriver(PortDeviceObject, Irp);
+
+Cleanup:
+ IoFreeWorkItem(WorkItemData->IoWorkItem);
+ ExFreePool(WorkItemData);
}
Modified: trunk/reactos/drivers/usb/usbehci/usbehci.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/usbehc…
==============================================================================
--- trunk/reactos/drivers/usb/usbehci/usbehci.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbehci/usbehci.h [iso-8859-1] Sun Jan 10 13:24:01 2010
@@ -366,6 +366,12 @@
} 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);