data_call: fix SG auto set apn

Change-Id: Iffef996e22d36578c03c370592eb2829806fc710
diff --git a/mbtk/mbtk_rild/src/mbtk_data_call.c b/mbtk/mbtk_rild/src/mbtk_data_call.c
old mode 100644
new mode 100755
index 385031b..85cb422
--- a/mbtk/mbtk_rild/src/mbtk_data_call.c
+++ b/mbtk/mbtk_rild/src/mbtk_data_call.c
@@ -565,7 +565,6 @@
 
             if(apn_init_flag)
             {
-                apn_init_flag = false;
                 mbtk_qser_apn_save(apn, apn_type, false);
             }
             (*apn_num)++;
@@ -575,7 +574,10 @@
     }
 
     *data_len = data_ptr - (uint8*)data;
-
+    if(apn_init_flag)
+    {
+        apn_init_flag = false;
+    }
     goto exit;
 exit:
     at_response_free(response);
@@ -671,6 +673,7 @@
     }
     else
     {
+#ifndef MBTK_SG_SUPPORT
         ret = mbtk_check_cid(apn->cid);
         if(ret < 0)
         {
@@ -678,7 +681,6 @@
             return MBTK_RESULT_FAIL;
         }
         
-#ifndef MBTK_SG_SUPPORT
         if(apn->cid == 1)
         {
             LOGE("cid 1 no support set.");
@@ -749,6 +751,14 @@
         str += len;
     }
 
+    LOGD("APN : %d, %d, %s, %s, %s, %s, %s.", apn->cid,
+                                        apn->ip_type,
+                                        (str_empty(apn->apn) ? "NULL" : apn->apn),
+                                        (str_empty(apn->user) ? "NULL" : apn->user),
+                                        (str_empty(apn->pass) ? "NULL" : apn->pass),
+                                        (str_empty(apn->auth) ? "NULL" : apn->auth),
+                                        (str_empty(apn_type) ? "NULL" : apn_type));
+    
     ret = mbtk_apn_check_num1(apn_type, apn->apn, apn->cid);
     if(ret < 0)
     {
@@ -762,14 +772,6 @@
         LOGE("num2_7 check error!");
         return MBTK_RESULT_FAIL;
     }
-
-    LOGD("APN : %d, %d, %s, %s, %s, %s, %s.", apn->cid,
-                                        apn->ip_type,
-                                        (str_empty(apn->apn) ? "NULL" : apn->apn),
-                                        (str_empty(apn->user) ? "NULL" : apn->user),
-                                        (str_empty(apn->pass) ? "NULL" : apn->pass),
-                                        (str_empty(apn->auth) ? "NULL" : apn->auth),
-                                        (str_empty(apn_type) ? "NULL" : apn_type));
     return MBTK_RESULT_SUCCESS;
 }