agm: return proper error value for session_obj_open

When failure comes in ec set during session_obj_open,
we will do graph close and wrongly returned ret value
for graph_close to PAL.

Return proper error value for session_obj_open.

Change-Id: I9426b03c75bb16125f7e803466e9c1949602a538
diff --git a/service/src/session_obj.c b/service/src/session_obj.c
index ff1ad33..5164976 100644
--- a/service/src/session_obj.c
+++ b/service/src/session_obj.c
@@ -1991,6 +1991,7 @@
 
     struct session_obj *sess_obj = NULL;
     int ret = 0;
+    int ret_unwind = 0;
     struct listnode *node;
     struct aif *aif_obj = NULL;
 
@@ -2074,17 +2075,17 @@
         aif_obj = node_to_item(node, struct aif, node);
         if (aif_obj && aif_obj->state == AIF_OPENED) {
             /*TODO: fix the 3rd argument to provide correct count*/
-            ret = session_disconnect_aif(sess_obj, aif_obj, 1);
-            if (ret) {
+            ret_unwind = session_disconnect_aif(sess_obj, aif_obj, 1);
+            if (ret_unwind) {
                 AGM_LOGE("Error:%d Failed to disconnect device\n",
-                                                     ret);
+                                                     ret_unwind);
             }
             aif_obj->state = AIF_OPEN;
         }
     }
-    ret = graph_close(sess_obj->graph);
-    if (ret) {
-        AGM_LOGE("Error:%d Failed to close graph\n", ret);
+    ret_unwind = graph_close(sess_obj->graph);
+    if (ret_unwind) {
+        AGM_LOGE("Error:%d Failed to close graph\n", ret_unwind);
     }
     sess_obj->graph = NULL;