Fix the coverity issues
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / services / mesh / bt-service-mesh-config-client.c
index 5a7810b..9b57173 100644 (file)
@@ -1156,13 +1156,13 @@ void _bt_mesh_config_client_devkey_msg_handler(
        int n;
        struct mesh_pending_request *req;
 
-       if (_bt_mesh_util_opcode_get(data, data_len, &opcode, &n)) {
-               BT_INFO("Mesh: Opcode of response data [0x%2.2x], actual data len [%d]", opcode, n);
-               data_len -= n;
-               data += n;
-       } else
+       if (_bt_mesh_util_opcode_get(data, data_len, &opcode, &n) == false)
                return;
 
+       BT_INFO("Mesh: Opcode of response data [0x%2.2x], actual data len [%d]", opcode, n);
+       data_len -= n;
+       data += n;
+
        BT_INFO("Mesh: Received %s (len %u) opcode [0x%2.2x]",
                __mesh_get_opcode_string(opcode), data_len, opcode);
 
@@ -1171,10 +1171,11 @@ void _bt_mesh_config_client_devkey_msg_handler(
        if (req) {
                BT_INFO("Mesh: Got Config Request");
                cmd = req->cmd;
-               __mesh_request_remove(req);
                l_queue_remove(pending_requests, req);
-       } else
+               __mesh_request_remove(req);
+       } else {
                cmd = NULL;
+       }
 
 
        switch (opcode & ~MESH_OPCODE_UNRELIABLE) {