surface_queue: fix return error type 20/58920/2
authorSangjin Lee <lsj119@samsung.com>
Fri, 5 Feb 2016 02:31:41 +0000 (11:31 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Fri, 5 Feb 2016 02:34:19 +0000 (18:34 -0800)
Change-Id: I969cc164a9446b8e4814a5bf7ca28fba0a82fc53

src/tbm_surface_queue.c

index 6fdcdd8..0b54da6 100644 (file)
@@ -442,10 +442,15 @@ tbm_surface_queue_error_e tbm_surface_queue_dequeue(tbm_surface_queue_h surface_
        else
                node = _tbm_surface_queue_dequeue(surface_queue);
 
-       if (node == NULL || node->surface == NULL) {
-               TBM_LOG("_queue_node_pop_front is failed\n");
+       if (node == NULL) {
+               *surface = NULL;
+               pthread_mutex_unlock(&surface_queue->lock);
+               return TBM_SURFACE_QUEUE_ERROR_EMPTY;
+       }
 
-        *surface = NULL;
+       if (node->surface == NULL) {
+               *surface = NULL;
+               TBM_LOG("_queue_node_pop_front  failed\n");
                pthread_mutex_unlock(&surface_queue->lock);
                return TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE;
        }
@@ -535,10 +540,15 @@ tbm_surface_queue_error_e tbm_surface_queue_acquire(tbm_surface_queue_h surface_
        else
                node = _tbm_surface_queue_acquire(surface_queue);
 
-       if (node == NULL || node->surface == NULL) {
-               TBM_LOG("_queue_node_pop_front  failed\n");
+       if (node == NULL) {
+               *surface = NULL;
+               pthread_mutex_unlock(&surface_queue->lock);
+               return TBM_SURFACE_QUEUE_ERROR_EMPTY;
+       }
 
-        *surface = NULL;
+       if (node->surface == NULL) {
+               *surface = NULL;
+               TBM_LOG("_queue_node_pop_front  failed\n");
                pthread_mutex_unlock(&surface_queue->lock);
                return TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE;
        }