From patchwork Wed Jan 11 08:59:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wang X-Patchwork-Id: 19116 X-Patchwork-Delegate: yuanhan.liu@linux.intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 22F17D59A; Wed, 11 Jan 2017 08:54:18 +0100 (CET) Received: from out1.zte.com.cn (out1.zte.com.cn [202.103.147.172]) by dpdk.org (Postfix) with ESMTP id 2E07669FC for ; Wed, 11 Jan 2017 08:54:14 +0100 (CET) X-MAILFROM: X-RCPTTO: X-FROMIP: 10.30.3.20 X-SEG-Scaned: 1 X-Received: unknown,10.30.3.20,20170111154603 Received: from unknown (HELO mse01.zte.com.cn) (10.30.3.20) by localhost with (AES256-SHA encrypted) SMTP; 11 Jan 2017 07:46:03 -0000 Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id v0B7s3XW037812; Wed, 11 Jan 2017 15:54:03 +0800 (GMT-8) (envelope-from wang.yong19@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.43.166.165]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2017011115540796-1081591 ; Wed, 11 Jan 2017 15:54:07 +0800 From: Yong Wang To: huawei.xie@intel.com, yuanhan.liu@linux.intel.com Cc: dev@dpdk.org, Yong Wang Date: Wed, 11 Jan 2017 03:59:46 -0500 Message-Id: <1484125186-31667-1-git-send-email-wang.yong19@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-01-11 15:54:08, Serialize by Router on notes_smtp/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-01-11 15:53:44, Serialize complete at 2017-01-11 15:53:44 X-MAIL: mse01.zte.com.cn v0B7s3XW037812 X-HQIP: 127.0.0.1 Subject: [dpdk-dev] [PATCH v2] examples/vhost: fix the wrong initialization of lcore_ids 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" when "TAILQ_INIT()" was added to the loop of "for (lcore_id = 0; ...)" statement, the assignment to "lcore_ids" was removed out of the loop. It changed the original initialization of "lcore_ids". Fix it by introducing two braces. Fixes: 45657a5c6861 ("examples/vhost: use tailq to link vhost devices") Signed-off-by: Yong Wang v2: * fix the coding style error of '++'. --- examples/vhost/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/vhost/main.c b/examples/vhost/main.c index ac1f6e2..91853ec 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -1436,11 +1436,12 @@ static inline void __attribute__((always_inline)) if (ret < 0) rte_exit(EXIT_FAILURE, "Invalid argument\n"); - for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id ++) + for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) { TAILQ_INIT(&lcore_info[lcore_id].vdev_list); if (rte_lcore_is_enabled(lcore_id)) - lcore_ids[core_id ++] = lcore_id; + lcore_ids[core_id++] = lcore_id; + } if (rte_lcore_count() > RTE_MAX_LCORE) rte_exit(EXIT_FAILURE,"Not enough cores\n");