Author: janderwald
Date: Fri May 8 03:33:27 2009
New Revision: 40832
URL:
http://svn.reactos.org/svn/reactos?rev=40832&view=rev
Log:
- When acquiring a mapping check if the mapping hasn't already been used
- Set tag value to zero when releasing a mapping
Modified:
trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c [iso-8859-1] Fri May 8
03:33:27 2009
@@ -142,7 +142,6 @@
IN PIRP Irp)
{
PIRP_MAPPING Mapping;
- ULONG Index;
IIrpQueueImpl * This = (IIrpQueueImpl*)iface;
Mapping = AllocateItem(NonPagedPool, sizeof(IRP_MAPPING), TAG_PORTCLASS);
@@ -183,8 +182,7 @@
return STATUS_UNSUCCESSFUL;
}
ASSERT(Mapping->NumTags < 32);
- for(Index = 0; Index < Mapping->NumTags; Index++);
- Mapping->References |= (1 << Index);
+ Mapping->References = (1 << Mapping->NumTags) - 1;
This->NumDataAvailable += Mapping->Header->DataUsed;
@@ -392,6 +390,7 @@
PIRP_MAPPING CurMapping;
PLIST_ENTRY CurEntry;
ULONG Index;
+ ULONG Value;
IIrpQueueImpl * This = (IIrpQueueImpl*)iface;
*Flags = 0;
@@ -413,7 +412,8 @@
CurMapping = CONTAINING_RECORD(CurEntry, IRP_MAPPING, Entry);
for(Index = 0; Index < CurMapping->NumTags; Index++)
{
- if (CurMapping->Tag[Index] == NULL)
+ Value = CurMapping->References & ( 1 << Index);
+ if (CurMapping->Tag[Index] == NULL && Value)
{
/* found a free mapping within audio irp */
GetMapping(This, Index, Tag, CurMapping, PhysicalAddress, VirtualAddress,
ByteCount, Flags);
@@ -460,6 +460,7 @@
if (CurMapping->Tag[Index] == Tag)
{
Found = TRUE;
+ CurMapping->Tag[Index] = NULL;
break;
}
}