DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/failsafe: safer subdev iterator
@ 2017-08-17 15:52 Gaetan Rivet
  2017-08-18  0:39 ` Stephen Hemminger
  2017-08-23 13:05 ` [dpdk-dev] [PATCH v2] " Gaetan Rivet
  0 siblings, 2 replies; 5+ messages in thread
From: Gaetan Rivet @ 2017-08-17 15:52 UTC (permalink / raw)
  To: dev; +Cc: Gaetan Rivet

The sub_device iterator macro should follow the general gist of the
tailq API for an easier understanding and safer use.

Once the loop has finished, the iterator should be set to NULL.
If no sub_device was iterated upon, the iterator should still be NULL.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
 drivers/net/failsafe/failsafe_private.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index 0361cf4..6fa8de5 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -222,6 +222,7 @@ extern int mac_from_arg;
  */
 #define FOREACH_SUBDEV_STATE(s, i, dev, state)				\
 	for (i = fs_find_next((dev), 0, state);				\
+	     ((s = NULL) == NULL) &&					\
 	     i < PRIV(dev)->subs_tail && (s = &PRIV(dev)->subs[i]);	\
 	     i = fs_find_next((dev), i + 1, state))
 
-- 
2.1.4

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

end of thread, other threads:[~2017-08-28 12:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-17 15:52 [dpdk-dev] [PATCH] net/failsafe: safer subdev iterator Gaetan Rivet
2017-08-18  0:39 ` Stephen Hemminger
2017-08-18  7:43   ` Gaëtan Rivet
2017-08-23 13:05 ` [dpdk-dev] [PATCH v2] " Gaetan Rivet
2017-08-28 12:30   ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).