From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 09A9FA034E;
	Thu,  7 Nov 2019 16:04:07 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 1D6DB1BF66;
	Thu,  7 Nov 2019 16:03:36 +0100 (CET)
Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com
 [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 27CCA1BF4E
 for <dev@dpdk.org>; Thu,  7 Nov 2019 16:03:33 +0100 (CET)
Received: from pps.filterd (m0045849.ppops.net [127.0.0.1])
 by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id
 xA7Eslt2023790; Thu, 7 Nov 2019 07:03:32 -0800
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : in-reply-to : references : mime-version :
 content-type : content-transfer-encoding; s=pfpt0818;
 bh=pk9RtfnfNEJMJO0DXdEDbG7LkYNx29JxmxXFwUW+rOI=;
 b=YUlKkmrsuycrPVgqownAMXK8bsPgnDwcaAxqAEA4QrM4CKnfJPvitX/o3Y1vhkM5LKGu
 iEHlWDsUPWj2LSr6FLV5mmFKUVn5wR5JYli4szCM+cakqlhoALQaScsgf9qwvEUl9no9
 d2AUKjja2s0zN6Vu/507r8eppJzBIFQK8/t/XdfZklYjD1h0gcgcW0ULb1GPgB00zBYl
 JP6KlYY0gMjCzNQPa18UV7jjkHiat1c7kO4yaFvnjXxe/5kcutekoxXCKryfZiHXPhZ3
 sXqbh54/v/Gl4ThCQv34MFWnbw0AZpVyupF+22nE3FjUabrjl6qioVzHQ7nx3woySfZN eg== 
Received: from sc-exch01.marvell.com ([199.233.58.181])
 by mx0a-0016f401.pphosted.com with ESMTP id 2w41uwvrdr-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Thu, 07 Nov 2019 07:03:32 -0800
Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH01.marvell.com
 (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 7 Nov
 2019 07:03:31 -0800
Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com
 (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend
 Transport; Thu, 7 Nov 2019 07:03:31 -0800
Received: from amok.marvell.com (unknown [10.95.130.48])
 by maili.marvell.com (Postfix) with ESMTP id C7BDE3F7040;
 Thu,  7 Nov 2019 07:03:29 -0800 (PST)
From: Andrzej Ostruszka <aostruszka@marvell.com>
To: <dev@dpdk.org>, Erik Gabriel Carrillo <erik.g.carrillo@intel.com>, "Jerin
 Jacob" <jerinj@marvell.com>
CC: <mattias.ronnblom@ericsson.com>, <stephen@networkplumber.org>
Date: Thu, 7 Nov 2019 16:03:10 +0100
Message-ID: <20191107150318.3677-5-aostruszka@marvell.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20191107150318.3677-1-aostruszka@marvell.com>
References: <20191029141212.4907-1-aostruszka@marvell.com>
 <20191107150318.3677-1-aostruszka@marvell.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572
 definitions=2019-11-07_05:2019-11-07,2019-11-07 signatures=0
Subject: [dpdk-dev] [PATCH v7 04/12] eventdev: fix possible use of
	uninitialized var
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Fix the logic for the case of event queue allowing all schedule types.

Compiler warning pointing to this error (with LTO enabled):
error: ‘sched_type’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
  if ((ret < 0 && ret != -EOVERFLOW) ||

Fixes: 6750b21bd6af ("eventdev: add default software timer adapter")
Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
---
 lib/librte_eventdev/rte_event_timer_adapter.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_eventdev/rte_event_timer_adapter.c b/lib/librte_eventdev/rte_event_timer_adapter.c
index 5ce399eca..161e21a68 100644
--- a/lib/librte_eventdev/rte_event_timer_adapter.c
+++ b/lib/librte_eventdev/rte_event_timer_adapter.c
@@ -706,11 +706,11 @@ check_destination_event_queue(struct rte_event_timer *evtim,
 				       RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE,
 				       &sched_type);
 
-	if ((ret < 0 && ret != -EOVERFLOW) ||
-	    evtim->ev.sched_type != sched_type)
-		return -1;
+	if ((ret == 0 && evtim->ev.sched_type == sched_type) ||
+	    ret == -EOVERFLOW)
+		return 0;
 
-	return 0;
+	return -1;
 }
 
 static int
-- 
2.17.1