]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/rm-lld.git/commitdiff
Preallocation routine will now correctly get next tree node during resource search
authorJustin Sobota <jsobota@ti.com>
Wed, 8 May 2013 15:37:10 +0000 (11:37 -0400)
committerJustin Sobota <jsobota@ti.com>
Wed, 8 May 2013 15:37:10 +0000 (11:37 -0400)
src/rm_allocator.c

index a77da21404fa766766d632bf6177b4d88ea99b01..0e74966c6ff6aabc5be411b2f543da058517a518 100644 (file)
@@ -386,6 +386,7 @@ static int32_t allocatorPreAllocate(Rm_Handle rmHandle, Rm_Allocator *allocator,
     Rm_Inst           *rmInst = (Rm_Inst *)rmHandle;
     Rm_ResourceNode    findNode;
     Rm_ResourceNode   *matchingNode = NULL;
     Rm_Inst           *rmInst = (Rm_Inst *)rmHandle;
     Rm_ResourceNode    findNode;
     Rm_ResourceNode   *matchingNode = NULL;
+    Rm_ResourceNode   *nextNode;
     uint32_t           matchingEnd;
     uint32_t           findEnd;
     uint32_t           rangeIndex;
     uint32_t           matchingEnd;
     uint32_t           findEnd;
     uint32_t           rangeIndex;
@@ -509,7 +510,12 @@ static int32_t allocatorPreAllocate(Rm_Handle rmHandle, Rm_Allocator *allocator,
                     findNode.base = matchingNode->base;
                 }
                 else {
                     findNode.base = matchingNode->base;
                 }
                 else {
-                    findNode.base = matchingNode->base + matchingNode->length;
+                    if (nextNode = RB_NEXT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, matchingNode)) {
+                        findNode.base = nextNode->base;
+                    }
+                    else {
+                        retVal = RM_SERVICE_DENIED_RES_ALLOC_REQS_NOT_MET;
+                    }
                 }
             }
         }
                 }
             }
         }