All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] examples/vhost: fix the wrong initialization of lcore_ids
@ 2017-01-11  8:59 Yong Wang
  2017-01-12  3:06 ` Yuanhan Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Yong Wang @ 2017-01-11  8:59 UTC (permalink / raw)
  To: huawei.xie, yuanhan.liu; +Cc: dev, Yong Wang

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 <wang.yong19@zte.com.cn>

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");
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] examples/vhost: fix the wrong initialization of lcore_ids
  2017-01-11  8:59 [PATCH v2] examples/vhost: fix the wrong initialization of lcore_ids Yong Wang
@ 2017-01-12  3:06 ` Yuanhan Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Yuanhan Liu @ 2017-01-12  3:06 UTC (permalink / raw)
  To: Yong Wang; +Cc: huawei.xie, dev

On Wed, Jan 11, 2017 at 03:59:46AM -0500, Yong Wang wrote:
> 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".

opps.... and nice catch! Thanks.
> 
> Fix it by introducing two braces.
> 
> Fixes: 45657a5c6861 ("examples/vhost: use tailq to link vhost devices")
> 
> Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>

Applied to dpdk-next-virtio.

	--yliu

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-12  3:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-11  8:59 [PATCH v2] examples/vhost: fix the wrong initialization of lcore_ids Yong Wang
2017-01-12  3:06 ` Yuanhan Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.