From: John Hodge Date: Fri, 26 Apr 2013 05:34:07 +0000 (+0800) Subject: Kernel/x86 - mm_virt: Allowed PhysAddr=NULL with AllocDMA X-Git-Tag: rel0.15~512 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=7e41140a5944c869fcc282c8546acd8aefeea8c3;p=tpg%2Facess2.git Kernel/x86 - mm_virt: Allowed PhysAddr=NULL with AllocDMA --- 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; }