From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f48.google.com (mail-pg0-f48.google.com [74.125.83.48]) by dpdk.org (Postfix) with ESMTP id 5AA3690F7 for ; Fri, 18 Aug 2017 02:52:44 +0200 (CEST) Received: by mail-pg0-f48.google.com with SMTP id t3so25241655pgt.0 for ; Thu, 17 Aug 2017 17:52:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BsFZWuHeHlDsA0bS0oBHzPzbfBjiq/5AoJHqYGH3PUI=; b=TCu25HYhsNoXbqX/bgz6Jgn34G8LIZJJRxBjlRpiYCzmWRP1BHB4HO5LdakYMF/QNF 7PhklCMZisgEzOKN+dbuk8Ot3H6kVMBbpRIxO6VY+0j4OdO2aJqu2lSFFifc/4RvWpEk J4XK7BebpW+e1JJqzjRrOydRDrWtzlTZMNn+67uh+acZHXfC/Jw4p19iyVfd7U07n7Mv 7dHQQM/jY6vQhNCyQgyU8QBjw9oSCn9XcveFJkOzuiZP53omOuVP0xZMDfCNFQDL9OUB If4Nc+jVVGHN++YAYmS1xdD2++EAM/Em63xK0l1uvp/aZT1Of9gzMigfbk26+ww9VM4+ QwYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BsFZWuHeHlDsA0bS0oBHzPzbfBjiq/5AoJHqYGH3PUI=; b=iPjeFEbWHSXfC3DsbbBjHx8AFVkb+AWfYpLWTQcVFNcR0KR5FGjkmlHZMP2dxNAhQu 1VSANy00KKLwaDNCnQ+x7I/u8soZHH3gy6xMmaPGFmtwtKvTLYiUX/Hr4BAD6igVY75q y7tK+4Fw/CZCodZlYZZbShsl4qTmJK4zPudh88xc5+f1iG3eqNIBdfYp0VwE6+c0C73U CXOULt9yvzXk/+FuxHztlixYQ3jIiESdiCnt8dHYwYC/8HFbRSXHdvb8cfLOpWUlmMEv acOJ5ewaPYYn8qmMKiyk6ExP8QyOsrpNUjIOyv8KSO6CQuW4nVsE0RJpJW31T6GcZf1+ pW+g== X-Gm-Message-State: AHYfb5jlqGxM1XOQq7wzUvs5Gs4TxOYyjq+692EPUkRp8u/SkkA08Nxd 5+fKlKuWxmUpk0QtG3c61g== X-Received: by 10.99.95.2 with SMTP id t2mr5767147pgb.351.1503017563637; Thu, 17 Aug 2017 17:52:43 -0700 (PDT) Received: from xeon-e3 (76-14-207-240.or.wavecable.com. [76.14.207.240]) by smtp.gmail.com with ESMTPSA id s189sm611927pgc.28.2017.08.17.17.52.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Aug 2017 17:52:43 -0700 (PDT) Date: Thu, 17 Aug 2017 17:39:29 -0700 From: Stephen Hemminger To: Gaetan Rivet Cc: dev@dpdk.org Message-ID: <20170817173929.4f8951c3@xeon-e3> In-Reply-To: <1502985129-7461-1-git-send-email-gaetan.rivet@6wind.com> References: <1502985129-7461-1-git-send-email-gaetan.rivet@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] net/failsafe: safer subdev iterator 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: , X-List-Received-Date: Fri, 18 Aug 2017 00:52:44 -0000 On Thu, 17 Aug 2017 17:52:09 +0200 Gaetan Rivet wrote: > 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 > --- > 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 assume you are trying to do assignment inside an expression and just expect that to always to be true and go onto next part of assignment. This is a convulted way to put code in the loop iterator. But this macro is way too complex. Please break it up into inline functions or figure out how to simplify the logic better.