From patchwork Thu May 17 13:49:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Green X-Patchwork-Id: 40153 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 12A8C7CB5; Thu, 17 May 2018 15:49:37 +0200 (CEST) Received: from mail.warmcat.com (mail.warmcat.com [163.172.24.82]) by dpdk.org (Postfix) with ESMTP id 055FE7CD7 for ; Thu, 17 May 2018 15:49:31 +0200 (CEST) From: Andy Green To: dev@dpdk.org Date: Thu, 17 May 2018 21:49:27 +0800 Message-ID: <152656496724.46638.11763540665522361262.stgit@localhost.localdomain> In-Reply-To: <152656480225.46638.3271983577765861155.stgit@localhost.localdomain> References: <152656480225.46638.3271983577765861155.stgit@localhost.localdomain> User-Agent: StGit/unknown-version Subject: [dpdk-dev] [PATCH v5 07/21] rte_mbuf.h: avoid warnings from inadvertant promotion X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" "1 + value", where value is an uint16_t causes promotion to a signed int. The compiler complained that we are shoving an int into a uint16_t return type with different size and sign. Bumping and returning value directly instead removes the promotion and the problem. Signed-off-by: Andy Green --- lib/librte_mbuf/rte_mbuf.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 4fd9a0d9e..a2a37a311 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -836,8 +836,9 @@ rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value) * reference counter can occur. */ if (likely(rte_mbuf_refcnt_read(m) == 1)) { - rte_mbuf_refcnt_set(m, 1 + value); - return 1 + value; + ++value; + rte_mbuf_refcnt_set(m, value); + return value; } return __rte_mbuf_refcnt_update(m, value); @@ -927,8 +928,9 @@ rte_mbuf_ext_refcnt_update(struct rte_mbuf_ext_shared_info *shinfo, int16_t value) { if (likely(rte_mbuf_ext_refcnt_read(shinfo) == 1)) { - rte_mbuf_ext_refcnt_set(shinfo, 1 + value); - return 1 + value; + ++value; + rte_mbuf_ext_refcnt_set(shinfo, value); + return value; } return (uint16_t)rte_atomic16_add_return(&shinfo->refcnt_atomic, value);