Clean up OCStop in C stack
authorSakthivel Samidurai <sakthivel.samidurai@intel.com>
Mon, 23 Mar 2015 21:00:11 +0000 (14:00 -0700)
committerErich Keane <erich.keane@intel.com>
Tue, 24 Mar 2015 22:30:12 +0000 (22:30 +0000)
Cleanup OCStop method in the C stack. Remove unnecessary
error check.

Change-Id: I4a1618c684c685a32f70b3087f08fca0961d3461
Signed-off-by: Sakthivel Samidurai <sakthivel.samidurai@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/545
Reviewed-by: Sachin Agrawal <sachin.agrawal@intel.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Erich Keane <erich.keane@intel.com>
resource/csdk/stack/src/ocstack.c

index c859a15..1c8630f 100644 (file)
@@ -1150,8 +1150,6 @@ exit:
  */
 OCStackResult OCStop()
 {
-    OCStackResult result = OC_STACK_ERROR;
-
     OC_LOG(INFO, TAG, PCF("Entering OCStop"));
 
     if (stackState == OC_STACK_UNINIT_IN_PROGRESS)
@@ -1177,30 +1175,14 @@ OCStackResult OCStop()
     deleteAllResources();
     DeleteDeviceInfo();
     CATerminate();
-    //CATerminate does not return any error code. It is OK to assign result to OC_STACK_OK.
-    result = OC_STACK_OK;
-
-    if (result == OC_STACK_OK)
-    {
-        // Remove all observers
-        DeleteObserverList();
-        // Remove all the client callbacks
-        DeleteClientCBList();
-        stackState = OC_STACK_UNINITIALIZED;
-        result = OC_STACK_OK;
-    } else {
-        stackState = OC_STACK_INITIALIZED;
-        result = OC_STACK_ERROR;
-    }
-
+    // Remove all observers
+    DeleteObserverList();
+    // Remove all the client callbacks
+    DeleteClientCBList();
     // Deinit security blob
     DeinitOCSecurityInfo();
-
-    if (result != OC_STACK_OK) {
-        OC_LOG(ERROR, TAG, PCF("Stack stop error"));
-    }
-
-    return result;
+    stackState = OC_STACK_UNINITIALIZED;
+    return OC_STACK_OK;
 }
 
 /**