From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f177.google.com (mail-wr0-f177.google.com [209.85.128.177]) by dpdk.org (Postfix) with ESMTP id 17997915D for ; Thu, 17 Aug 2017 17:52:25 +0200 (CEST) Received: by mail-wr0-f177.google.com with SMTP id f8so2976948wrf.3 for ; Thu, 17 Aug 2017 08:52:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=lhC2Wu0V4I4KcYdQnNrMW+Xbr5y7D4JSLqAWKf2sMxA=; b=FM/oC3leRgVnO27Hn8S+7ML1yaBxes2pOpWroVVz3DX+eH5BREedKL6rFO8C6wk4cQ DYgNYfTCQLmGO2EKBO0nSxyEIkr+48AaaLA4jsvbpYViORI7JScJGITQ4jZVFT/Sk6lP fNNnJVTC5966AXv3spSIK04r6fjerMvLBmvFRlnrp4mowi7mZNnjFojJRb3Xplacz0VT l61LLheflTIiLhn9v+7TggLDpH7O9dOnOoKwn6V2DvzcDOA/PYcjMomNnoIc030U/vtd UBkql1VfDAy6aUIPrnVOSICxuoSw+7eqqpiGt8BzHTroq5zzxUk+Pw3ph1NiabrYdlUv NMoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=lhC2Wu0V4I4KcYdQnNrMW+Xbr5y7D4JSLqAWKf2sMxA=; b=FysN5iZqfwdImDsW9IzJ56lK4/5G4Re7IuN1ivFHPAiAtFz1oSbZs23rrbHIoVDtLd ZBgD2CBkhtUJ6GzHJi+QTZcNKObY1gOgKt7/l9fFUfsQ9FWteIT/2RsqdAHqp1bn6J6H pNNsyMM1wooA2GvojgjZp4IXynBUnrmxhjoIKF83gtOrz+Ha13MovxVG5C30hpJYYVbv 0lhS22XiKSUFwQkqIza7SRTM07fojyKwG4Ce9hWnEG/JAd9I8b/oG297g+ZZDIIOKnaA IM6xyL+7VqzUiII2EAby17YtVh+w+UwcQ/4gyE1tlML50qHMolNiVS+L1m8yT0mzLdoa o/Cw== X-Gm-Message-State: AHYfb5i9h5Dtr2XzvfxG2MhDNKRbJEeiy5KSR025aBMqImpgCQQ3FbAz 4WXI5GX46MfwCczOv+0= X-Received: by 10.28.109.27 with SMTP id i27mr1418724wmc.173.1502985144310; Thu, 17 Aug 2017 08:52:24 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id p45sm4036679wrb.75.2017.08.17.08.52.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Aug 2017 08:52:23 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 17 Aug 2017 17:52:09 +0200 Message-Id: <1502985129-7461-1-git-send-email-gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 Subject: [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: Thu, 17 Aug 2017 15:52:25 -0000 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 < PRIV(dev)->subs_tail && (s = &PRIV(dev)->subs[i]); \ i = fs_find_next((dev), i + 1, state)) -- 2.1.4