Fix wrong check of empty queue 32/190632/2
authorDongwoo <dwoo08.lee@samsung.com>
Thu, 4 Oct 2018 08:40:07 +0000 (17:40 +0900)
committerDongwoo <dwoo08.lee@samsung.com>
Thu, 4 Oct 2018 08:50:16 +0000 (17:50 +0900)
This patch resolves svace warnings "DEREF_OF_NULL", which means that can
have only NULL value. Even it is false positive, the condition is also
wrong because it should continue iteration if queue is not empty.

Change-Id: I445463c9ef4522e3e58923fbcbda01d0ce606dcc
Signed-off-by: Dongwoo <dwoo08.lee@samsung.com>
src/dfu.c

index 9beaf95d1888a1cf18fb18ab06fc1ef828b92d30..f174a7e9b05d7d71460dee1e3002dc3ff59e1ec1 100644 (file)
--- a/src/dfu.c
+++ b/src/dfu.c
@@ -371,7 +371,7 @@ static void *dfu_thread_main(void *ptr)
        }
 
        pthread_mutex_lock(&ctx->dfu_mutex);
-       while (TAILQ_EMPTY(&ctx->dfu_ioq_head)) {
+       while (!TAILQ_EMPTY(&ctx->dfu_ioq_head)) {
                frame = TAILQ_FIRST(&ctx->dfu_ioq_head);
 
                TAILQ_REMOVE(&ctx->dfu_ioq_head, frame, entry);