@@ -456,35 +456,27 @@ void MEM_FlushCache(void *pMemBuf, u32 cBytes, s32 FlushType)
void MEM_VFree(IN void *pMemBuf)
{
#ifdef MEM_CHECK
- struct memInfo *pMem = (void *)((u32)pMemBuf - sizeof(struct memInfo));
+ struct memInfo *pMem;
#endif
-
- DBC_Require(pMemBuf != NULL);
-
GT_1trace(MEM_debugMask, GT_ENTER, "MEM_VFree: pMemBufs 0x%x\n",
- pMemBuf);
-
- if (pMemBuf) {
-#ifndef MEM_CHECK
- vfree(pMemBuf);
+ pMemBuf);
+#ifdef MEM_CHECK
+ if (!pMemBuf) {
+ GT_1trace(MEM_debugMask, GT_7CLASS,
+ "Invalid allocation or Buffer underflow\n");
+ return;
+ }
+ pMem = (void *)((u32)pMemBuf - sizeof(struct memInfo));
+ if (pMem && pMem->dwSignature == memInfoSign) {
+ spin_lock(&mMan.lock);
+ MLST_RemoveElem(&mMan.lst, (struct list_head *)pMem);
+ spin_unlock(&mMan.lock);
+ pMem->dwSignature = 0;
+ vfree(pMem);
+ }
#else
- if (pMem) {
- if (pMem->dwSignature == memInfoSign) {
- spin_lock(&mMan.lock);
- MLST_RemoveElem(&mMan.lst,
- (struct list_head *)pMem);
- spin_unlock(&mMan.lock);
- pMem->dwSignature = 0;
- vfree(pMem);
- } else {
- GT_1trace(MEM_debugMask, GT_7CLASS,
- "Invalid allocation or "
- "Buffer underflow at %x\n",
- (u32) pMem + sizeof(struct memInfo));
- }
- }
+ vfree(pMemBuf);
#endif
- }
}
/*