From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 863282B84 for ; Fri, 16 Sep 2016 18:28:32 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP; 16 Sep 2016 09:28:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,345,1470726000"; d="scan'208";a="169525723" Received: from sivswdev02.ir.intel.com (HELO localhost.localdomain) ([10.237.217.46]) by fmsmga004.fm.intel.com with ESMTP; 16 Sep 2016 09:28:28 -0700 From: Ferruh Yigit To: dev@dpdk.org Cc: Ferruh Yigit Date: Fri, 16 Sep 2016 17:26:42 +0100 Message-Id: <1474043212-15663-10-git-send-email-ferruh.yigit@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1473954405-7150-1-git-send-email-ferruh.yigit@intel.com> References: <1473954405-7150-1-git-send-email-ferruh.yigit@intel.com> Subject: [dpdk-dev] [PATCH v2 09/19] kni: do not use assignment in if condition X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2016 16:28:32 -0000 Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/kni_vhost.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c index bef4889..eacfe3f 100644 --- a/lib/librte_eal/linuxapp/kni/kni_vhost.c +++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c @@ -410,13 +410,14 @@ kni_sock_rcvmsg(struct socket *sock, #ifdef RTE_KNI_VHOST_VNET_HDR_EN if (likely(q->flags & IFF_VNET_HDR)) { vnet_hdr_len = q->vnet_hdr_sz; - if ((len -= vnet_hdr_len) < 0) + len -= vnet_hdr_len; + if (len < 0) return -EINVAL; } #endif - if (unlikely(0 == (pkt_len = kni_vhost_net_rx(q->kni, - m, vnet_hdr_len, len)))) + pkt_len = kni_vhost_net_rx(q->kni, m, vnet_hdr_len, len); + if (unlikely(pkt_len == 0)) return 0; #ifdef RTE_KNI_VHOST_VNET_HDR_EN @@ -567,7 +568,8 @@ kni_sock_release(struct socket *sock) if (q == NULL) return 0; - if (NULL != (kni = q->kni)) { + kni = q->kni; + if (kni != NULL) { kni->vq_status = BE_STOP; KNI_VHOST_WAIT_WQ_SAFE(); kni->vhost_queue = NULL; -- 2.7.4