https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c03b2ed9bebdc9b68539f…
commit c03b2ed9bebdc9b68539f863f8f6ea853989e961
Author: Serge Gautherie <32623169+SergeGautherie(a)users.noreply.github.com>
AuthorDate: Fri Oct 20 18:09:03 2023 +0200
Commit: GitHub <noreply(a)github.com>
CommitDate: Fri Oct 20 18:09:03 2023 +0200
[HDAUDBUS][KS][WDMAUD] Use ExAllocatePoolZero() and ExFreePoolWithTag() (#5792)
And promote/fix 2 DPRINTs as well.
---
drivers/ksfilter/ks/filterfactory.c | 3 +--
drivers/ksfilter/ks/misc.c | 12 ++----------
drivers/wdm/audio/hdaudbus/fdo.cpp | 5 ++---
drivers/wdm/audio/hdaudbus/hdaudbus.cpp | 13 +++++--------
drivers/wdm/audio/legacy/wdmaud/sup.c | 18 +++---------------
5 files changed, 13 insertions(+), 38 deletions(-)
diff --git a/drivers/ksfilter/ks/filterfactory.c b/drivers/ksfilter/ks/filterfactory.c
index aed00b05d92..be907d8df9c 100644
--- a/drivers/ksfilter/ks/filterfactory.c
+++ b/drivers/ksfilter/ks/filterfactory.c
@@ -247,7 +247,7 @@ IKsFilterFactory_fnInitialize(
This->FilterFactory.FilterDescriptor = AllocateItem(NonPagedPool,
sizeof(KSFILTER_DESCRIPTOR));
if (!This->FilterFactory.FilterDescriptor)
{
- DPRINT("out of memory");
+ DPRINT1("Out of memory\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
RtlMoveMemory((PVOID)This->FilterFactory.FilterDescriptor, (PVOID)Descriptor,
sizeof(KSFILTER_DESCRIPTOR));
@@ -751,4 +751,3 @@ KsFilterFactoryUpdateCacheData(
/* done */
return Status;
}
-
diff --git a/drivers/ksfilter/ks/misc.c b/drivers/ksfilter/ks/misc.c
index 5174f850cf0..e2656442d3e 100644
--- a/drivers/ksfilter/ks/misc.c
+++ b/drivers/ksfilter/ks/misc.c
@@ -22,7 +22,6 @@ CompleteRequest(
ASSERT(Irp->IoStatus.Status != STATUS_PENDING);
-
IoCompleteRequest(Irp, PriorityBoost);
}
@@ -31,19 +30,14 @@ AllocateItem(
IN POOL_TYPE PoolType,
IN SIZE_T NumberOfBytes)
{
- PVOID Item = ExAllocatePoolWithTag(PoolType, NumberOfBytes, TAG_KS);
- if (!Item)
- return Item;
-
- RtlZeroMemory(Item, NumberOfBytes);
- return Item;
+ return ExAllocatePoolZero(PoolType, NumberOfBytes, TAG_KS);
}
VOID
FreeItem(
IN PVOID Item)
{
- ExFreePool(Item);
+ ExFreePoolWithTag(Item, TAG_KS);
}
NTSTATUS
@@ -172,5 +166,3 @@ KsGetParent(
/* return object type */
return (PVOID)BasicHeader->Parent.KsDevice;
}
-
-
diff --git a/drivers/wdm/audio/hdaudbus/fdo.cpp b/drivers/wdm/audio/hdaudbus/fdo.cpp
index 7088ee933c3..59eaf7d48ec 100644
--- a/drivers/wdm/audio/hdaudbus/fdo.cpp
+++ b/drivers/wdm/audio/hdaudbus/fdo.cpp
@@ -5,6 +5,7 @@
* PURPOSE: HDA Driver Entry
* PROGRAMMER: Johannes Anderwald
*/
+
#include "hdaudbus.h"
BOOLEAN
@@ -217,7 +218,7 @@ HDA_InitCodec(
Entry = (PHDA_CODEC_ENTRY)AllocateItem(NonPagedPool, sizeof(HDA_CODEC_ENTRY));
if (!Entry)
{
- DPRINT1("hda: failed to allocate memory");
+ DPRINT1("hda: failed to allocate memory\n");
return STATUS_UNSUCCESSFUL;
}
@@ -812,5 +813,3 @@ HDA_FDOQueryBusRelations(
/* done */
return STATUS_SUCCESS;
}
-
-
diff --git a/drivers/wdm/audio/hdaudbus/hdaudbus.cpp
b/drivers/wdm/audio/hdaudbus/hdaudbus.cpp
index 88e82c6b7ed..5522d18033f 100644
--- a/drivers/wdm/audio/hdaudbus/hdaudbus.cpp
+++ b/drivers/wdm/audio/hdaudbus/hdaudbus.cpp
@@ -5,6 +5,7 @@
* PURPOSE: HDA Driver Entry
* PROGRAMMER: Johannes Anderwald
*/
+
#include "hdaudbus.h"
DRIVER_DISPATCH HDA_Pnp;
@@ -19,19 +20,14 @@ AllocateItem(
_In_ POOL_TYPE PoolType,
_In_ SIZE_T NumberOfBytes)
{
- PVOID Item = ExAllocatePoolWithTag(PoolType, NumberOfBytes, TAG_HDA);
- if (!Item)
- return Item;
-
- RtlZeroMemory(Item, NumberOfBytes);
- return Item;
+ return ExAllocatePoolZero(PoolType, NumberOfBytes, TAG_HDA);
}
VOID
FreeItem(
__drv_freesMem(Mem) PVOID Item)
{
- ExFreePool(Item);
+ ExFreePoolWithTag(Item, TAG_HDA);
}
NTSTATUS
@@ -305,6 +301,7 @@ HDA_Unload(
extern "C"
{
+
NTSTATUS
NTAPI
DriverEntry(
@@ -320,4 +317,4 @@ DriverEntry(
return STATUS_SUCCESS;
}
-}
+} // extern "C"
diff --git a/drivers/wdm/audio/legacy/wdmaud/sup.c
b/drivers/wdm/audio/legacy/wdmaud/sup.c
index 91334c09bb3..496eabf56e2 100644
--- a/drivers/wdm/audio/legacy/wdmaud/sup.c
+++ b/drivers/wdm/audio/legacy/wdmaud/sup.c
@@ -21,23 +21,16 @@ AllocateItem(
IN POOL_TYPE PoolType,
IN SIZE_T NumberOfBytes)
{
- PVOID Item = ExAllocatePoolWithTag(PoolType, NumberOfBytes, TAG_WDMAUD);
- if (!Item)
- return Item;
-
- RtlZeroMemory(Item, NumberOfBytes);
- return Item;
+ return ExAllocatePoolZero(PoolType, NumberOfBytes, TAG_WDMAUD);
}
VOID
FreeItem(
IN PVOID Item)
{
- ExFreePool(Item);
+ ExFreePoolWithTag(Item, TAG_WDMAUD);
}
-
-
ULONG
GetSysAudioDeviceCount(
IN PDEVICE_OBJECT DeviceObject)
@@ -62,7 +55,6 @@ GetSysAudioDeviceCount(
return Count;
}
-
NTSTATUS
SetIrpIoStatus(
IN PIRP Irp,
@@ -72,8 +64,8 @@ SetIrpIoStatus(
Irp->IoStatus.Information = Length;
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return Status;
+ return Status;
}
ULONG
@@ -186,7 +178,6 @@ ReadKeyValue(
return PartialInformation;
}
-
NTSTATUS
CompareProductName(
IN HANDLE hSubKey,
@@ -248,8 +239,6 @@ CompareProductName(
return STATUS_SUCCESS;
}
-
-
NTSTATUS
FindProductName(
IN LPWSTR PnpName,
@@ -431,5 +420,4 @@ OpenDevice(
}
return Status;
-
}