]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/rm-lld.git/blobdiff - src/rm_services.c
Fix PRSDK-442
[keystone-rtos/rm-lld.git] / src / rm_services.c
index 97c828d728043c76dde2c2505f29c3f9987b5e40..46ac94bf84714f065a412b5b2b07e0c0d42b105f 100644 (file)
@@ -6,7 +6,7 @@
  *
  *  \par
  *  ============================================================================
- *  @n   (C) Copyright 2012-2015, Texas Instruments, Inc.
+ *  @n   (C) Copyright 2012-2016, Texas Instruments, Inc.
  * 
  *  Redistribution and use in source and binary forms, with or without 
  *  modification, are permitted provided that the following conditions 
@@ -96,35 +96,36 @@ void Rm_serviceHandler (void *rmHandle, const Rm_ServiceReqInfo *serviceRequest,
     void           *key;
     void           *mtKey;
 
-    RM_SS_INST_INV_ENTER_CS(rmInst, key);
-    RM_SC_INST_INV_ENTER_CS(rmInst, key);
-    if (rmInst->mtSemObj) {
-        mtKey = Rm_osalMtCsEnter(rmInst->mtSemObj);
-    }
-
-    if (rmInst->isLocked) {
-        serviceResponse->serviceState = RM_SERVICE_DENIED_RM_INSTANCE_LOCKED;
-        goto errorExit;
-    }
-
     if (serviceRequest->type >= Rm_service_LAST) {
         serviceResponse->serviceState = RM_ERROR_INVALID_SERVICE_TYPE;
-        goto errorExit;
+        return;
     }
 
     if (serviceRequest->resourceName) {
         if ((strlen(serviceRequest->resourceName) + 1) > RM_NAME_MAX_CHARS) {
             serviceResponse->serviceState = RM_ERROR_RESOURCE_NAME_TOO_LONG;
-            goto errorExit;
+            return;
         }
     }
 
     if (serviceRequest->resourceNsName) {
         if ((strlen(serviceRequest->resourceNsName) + 1) > RM_NAME_MAX_CHARS) {
             serviceResponse->serviceState = RM_ERROR_NAMESERVER_NAME_TOO_LONG;
-            goto errorExit;
+            return;
         }
     }
+    
+    if (rmInst->isLocked) {
+        serviceResponse->serviceState = RM_SERVICE_DENIED_RM_INSTANCE_LOCKED;
+        return;
+    }
+
+    RM_SS_INST_INV_ENTER_CS(rmInst, key);
+    RM_SC_INST_INV_ENTER_CS(rmInst, key);
+
+    if (rmInst->mtSemObj) {
+        mtKey = Rm_osalMtCsEnter(rmInst->mtSemObj);
+    }
 
     /* Copy location of instance name to local variable in case Shared Client
      * needs to transfer control to a shared server */
@@ -213,7 +214,6 @@ void Rm_serviceHandler (void *rmHandle, const Rm_ServiceReqInfo *serviceRequest,
         serviceResponse->serviceState = RM_ERROR_SERVICE_TRANS_NOT_CREATED;
     }
 
-errorExit:
     /* Free sem object using originating instance in case the Shared Client to
      * Shared Server instance switch took place */
     if (((Rm_Inst *)rmHandle)->mtSemObj) {