summaryrefslogtreecommitdiff
path: root/ArmPkg
diff options
context:
space:
mode:
Diffstat (limited to 'ArmPkg')
-rw-r--r--ArmPkg/Library/ArmDmaLib/ArmDmaLib.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c b/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c
index 54a49a1..1e6b288 100644
--- a/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c
+++ b/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c
@@ -216,6 +216,8 @@ DmaAllocateBuffer (
OUT VOID **HostAddress
)
{
+ VOID *Allocation;
+
if (HostAddress == NULL) {
return EFI_INVALID_PARAMETER;
}
@@ -226,13 +228,19 @@ DmaAllocateBuffer (
// We used uncached memory to keep coherency
//
if (MemoryType == EfiBootServicesData) {
- *HostAddress = UncachedAllocatePages (Pages);
+ Allocation = UncachedAllocatePages (Pages);
} else if (MemoryType == EfiRuntimeServicesData) {
- *HostAddress = UncachedAllocateRuntimePages (Pages);
+ Allocation = UncachedAllocateRuntimePages (Pages);
} else {
return EFI_INVALID_PARAMETER;
}
+ if (Allocation == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ *HostAddress = Allocation;
+
return EFI_SUCCESS;
}