]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/rm-lld.git/blobdiff - src/rm.c
Fixed GCC compilation warnings
[keystone-rtos/rm-lld.git] / src / rm.c
index f75e5d5f55f76b595ba18c3ce72e487801ad5584..9bc65269bd656ce6dd26c0076ed50cc8aa841cd0 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
@@ -282,6 +282,9 @@ static void transactionResponder (Rm_Inst *rmInst, Rm_Transaction *transaction)
         case Rm_service_RESOURCE_UNMAP_NAME:
             createNsResponsePkt(rmPkt, transaction);
             break;
+        default:
+            transaction->state = RM_ERROR_INVALID_SERVICE_TYPE;
+            goto errorExit;
     }
     if (dstTransport->callouts.rmSendPkt(dstTransport->appTransportHandle, pktHandle) < RM_OK) {
         transaction->state = RM_ERROR_TRANSPORT_SEND_ERROR;
@@ -342,6 +345,9 @@ static void transactionForwarder (Rm_Inst *rmInst, Rm_Transaction *transaction)
             case Rm_service_RESOURCE_UNMAP_NAME:
                 createNsRequestPkt(rmPkt, rmInst->instName, transaction);
                 break;
+            default:
+                transaction->state = RM_ERROR_INVALID_SERVICE_TYPE;
+                goto errorExit;
         }
   
         if (dstTransport->callouts.rmSendPkt(dstTransport->appTransportHandle, pktHandle) < RM_OK) {
@@ -429,8 +435,8 @@ static int32_t cdRequestServerResources(Rm_Inst *rmInst, Rm_Transaction *transac
 
     resourceOffsetInPolicy = rmPolicyGetResourceOffset(policy, transaction->resourceInfo.name);
     if (resourceOffsetInPolicy > 0) {
-        if (allocSize = rmPolicyGetResourceCdAllocSize(policy, resourceOffsetInPolicy)) {
-            if (newTrans = rmTransactionQueueAdd(rmInst)) {
+        if ((allocSize = rmPolicyGetResourceCdAllocSize(policy, resourceOffsetInPolicy))) {
+            if ((newTrans = rmTransactionQueueAdd(rmInst))) {
                 newTrans->type = transaction->type;
                 rm_strncpy(newTrans->serviceSrcInstName, rmInst->instName, RM_NAME_MAX_CHARS);
                 newTrans->state = RM_SERVICE_PROCESSING;       
@@ -448,8 +454,8 @@ static int32_t cdRequestServerResources(Rm_Inst *rmInst, Rm_Transaction *transac
                 retVal = RM_SERVICE_PENDING_SERVER_RESPONSE;
             }
             else {
-                retVal = RM_ERROR_TRANS_REQ_TO_SERVER_NOT_CREATED;    
-            }       
+                retVal = RM_ERROR_TRANS_REQ_TO_SERVER_NOT_CREATED;
+            }
         }
         else {
             /* Forward request to Server for completion if policy has 
@@ -482,10 +488,10 @@ static int32_t cdFreeResourcesToServer(Rm_Inst *rmInst, Rm_Transaction *transact
      * so create transaction to Server to free localized resource node */
     if (rmAllocatorGetNodeLocalization((Rm_Handle)rmInst, transaction->resourceInfo.name,
                                        &baseToFree, &lenToFree)) {
-        if (newTrans = rmTransactionQueueAdd(rmInst)) {
+        if ((newTrans = rmTransactionQueueAdd(rmInst))) {
             newTrans->type = transaction->type;
             rm_strncpy(newTrans->serviceSrcInstName, rmInst->instName, RM_NAME_MAX_CHARS);
-            newTrans->state = RM_SERVICE_PROCESSING;       
+            newTrans->state = RM_SERVICE_PROCESSING;
             rm_strncpy(newTrans->resourceInfo.name, transaction->resourceInfo.name, RM_NAME_MAX_CHARS);
             newTrans->resourceInfo.base = baseToFree;
             newTrans->resourceInfo.length = lenToFree;
@@ -894,7 +900,7 @@ static void cdProcess (Rm_Inst *rmInst, Rm_Transaction *transaction)
                 else if ((transaction->type == Rm_service_RESOURCE_ALLOCATE_INIT) ||
                          (transaction->type == Rm_service_RESOURCE_ALLOCATE_USE)) {
                     /* Add resources provided by Server to those managed by CD */
-                    if (allocator = rmAllocatorFind((Rm_Handle)rmInst, transaction->resourceInfo.name)) {
+                    if ((allocator = rmAllocatorFind((Rm_Handle)rmInst, transaction->resourceInfo.name))) {
                         Rm_ResourceNode *treeNode = NULL;
                         
                         treeNode = rmResourceNodeNew(transaction->resourceInfo.base, transaction->resourceInfo.length);
@@ -960,7 +966,7 @@ static void cdProcess (Rm_Inst *rmInst, Rm_Transaction *transaction)
                 (strlen(transaction->resourceInfo.nameServerName) > 0)) {   
                 /* Create and forward new transaction to Server to
                  * retrieve resource data mapped to name */
-                if (newTrans = rmTransactionQueueAdd(rmInst)) {
+                if ((newTrans = rmTransactionQueueAdd(rmInst))) {
                     newTrans->type = Rm_service_RESOURCE_GET_BY_NAME;
                     rm_strncpy(newTrans->serviceSrcInstName, rmInst->instName, RM_NAME_MAX_CHARS);
                     newTrans->state = RM_SERVICE_PROCESSING;       
@@ -1037,7 +1043,7 @@ static void cdProcess (Rm_Inst *rmInst, Rm_Transaction *transaction)
  */
 static void serverProcess (Rm_Inst *rmInst, Rm_Transaction *transaction)
 {
-    Rm_NameServerObjCfg  nameServerObjCfg;        
+    Rm_NameServerObjCfg  nameServerObjCfg;
 
     switch (transaction->type) {
         case Rm_service_RESOURCE_STATUS:
@@ -1047,12 +1053,12 @@ static void serverProcess (Rm_Inst *rmInst, Rm_Transaction *transaction)
         case Rm_service_RESOURCE_ALLOCATE_USE:
             allocationHandler(rmInst, transaction);
             break;
-        case Rm_service_RESOURCE_FREE:               
+        case Rm_service_RESOURCE_FREE:
             freeHandler(rmInst, transaction);
             break;
         case Rm_service_RESOURCE_MAP_TO_NAME:
         case Rm_service_RESOURCE_GET_BY_NAME:
-        case Rm_service_RESOURCE_UNMAP_NAME:             
+        case Rm_service_RESOURCE_UNMAP_NAME:
             if (rmInst->u.server.nameServer) {
                 if (rmInst->instType == Rm_instType_SHARED_SERVER) {
                     rmNameServerTreeInv(rmInst->u.server.nameServer);
@@ -1087,6 +1093,9 @@ static void serverProcess (Rm_Inst *rmInst, Rm_Transaction *transaction)
                 transaction->state = RM_ERROR_NAMESERVER_DOES_NOT_EXIST;
             }
             break;
+        default:
+            transaction->state = RM_ERROR_INVALID_SERVICE_TYPE;
+            break;
     }
 
     /* Source of shared server transaction will always be local. */