From 7e41140a5944c869fcc282c8546acd8aefeea8c3 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 26 Apr 2013 13:34:07 +0800 Subject: [PATCH] Kernel/x86 - mm_virt: Allowed PhysAddr=NULL with AllocDMA --- KernelLand/Kernel/arch/x86/mm_virt.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/KernelLand/Kernel/arch/x86/mm_virt.c b/KernelLand/Kernel/arch/x86/mm_virt.c index e04b4ae7..13562f28 100644 --- a/KernelLand/Kernel/arch/x86/mm_virt.c +++ b/KernelLand/Kernel/arch/x86/mm_virt.c @@ -1080,7 +1080,7 @@ tVAddr MM_AllocDMA(int Pages, int MaxBits, tPAddr *PhysAddr) MaxBits = PHYS_BITS; // Sanity Check - if(MaxBits < 12 || !PhysAddr) { + if(MaxBits < 12) { LEAVE('i', 0); return 0; } @@ -1089,11 +1089,11 @@ tVAddr MM_AllocDMA(int Pages, int MaxBits, tPAddr *PhysAddr) if(Pages == 1 && MaxBits >= PHYS_BITS) { phys = MM_AllocPhys(); + if( PhysAddr ) + *PhysAddr = phys; if( !phys ) { - *PhysAddr = 0; LEAVE_RET('i', 0); } - *PhysAddr = phys; ret = MM_MapHWPages(phys, 1); if(ret == 0) { MM_DerefPhys(phys); @@ -1122,7 +1122,8 @@ tVAddr MM_AllocDMA(int Pages, int MaxBits, tPAddr *PhysAddr) return 0; } - *PhysAddr = phys; + if( PhysAddr ) + *PhysAddr = phys; LEAVE('x', ret); return ret; } -- 2.20.1