DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Anatoly Burakov <anatoly.burakov@intel.com>,
	Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH v2 1/6] eal: replace unnecessary comma operator
Date: Thu, 14 Aug 2025 14:28:47 -0700	[thread overview]
Message-ID: <20250814212901.88863-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20250814212901.88863-1-stephen@networkplumber.org>

Use of comma as statement separator is discouraged and
reported as warning by clang with -Wcomma

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/eal/common/rte_malloc.c | 4 ++--
 lib/eal/linux/eal_alarm.c   | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/eal/common/rte_malloc.c b/lib/eal/common/rte_malloc.c
index 3a86c19490..388e5a63b6 100644
--- a/lib/eal/common/rte_malloc.c
+++ b/lib/eal/common/rte_malloc.c
@@ -202,8 +202,8 @@ rte_realloc_socket(void *ptr, size_t size, unsigned int align, int socket)
 	}
 
 	user_size = size;
-
-	size = RTE_CACHE_LINE_ROUNDUP(size), align = RTE_CACHE_LINE_ROUNDUP(align);
+	size = RTE_CACHE_LINE_ROUNDUP(size);
+	align = RTE_CACHE_LINE_ROUNDUP(align);
 
 	/* check requested socket id and alignment matches first, and if ok,
 	 * see if we can resize block
diff --git a/lib/eal/linux/eal_alarm.c b/lib/eal/linux/eal_alarm.c
index eb6a21d4f0..a1433eb867 100644
--- a/lib/eal/linux/eal_alarm.c
+++ b/lib/eal/linux/eal_alarm.c
@@ -125,8 +125,10 @@ eal_alarm_callback(void *arg __rte_unused)
 		atime.it_value.tv_sec = ap->time.tv_sec;
 		atime.it_value.tv_nsec = ap->time.tv_usec * NS_PER_US;
 		/* perform borrow for subtraction if necessary */
-		if (now.tv_nsec > (ap->time.tv_usec * NS_PER_US))
-			atime.it_value.tv_sec--, atime.it_value.tv_nsec += US_PER_S * NS_PER_US;
+		if (now.tv_nsec > (ap->time.tv_usec * NS_PER_US)) {
+			atime.it_value.tv_sec--;
+			atime.it_value.tv_nsec += US_PER_S * NS_PER_US;
+		}
 
 		atime.it_value.tv_sec -= now.tv_sec;
 		atime.it_value.tv_nsec -= now.tv_nsec;
-- 
2.47.2


  reply	other threads:[~2025-08-14 21:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-12 23:26 [RFC 0/7] avoid unnecessary use of comma op Stephen Hemminger
2025-03-12 23:26 ` [RFC 1/7] eal: replace unnecessary comma operator Stephen Hemminger
2025-03-12 23:26 ` [RFC 2/7] ipsec: " Stephen Hemminger
2025-03-12 23:27 ` [RFC 3/7] graph: " Stephen Hemminger
2025-03-12 23:27 ` [RFC 4/7] net/mlx4: replace unnecessary comma operators Stephen Hemminger
2025-03-12 23:27 ` [RFC 5/7] net/mlx5: " Stephen Hemminger
2025-03-12 23:27 ` [RFC 6/7] test: " Stephen Hemminger
2025-03-12 23:27 ` [RFC 7/7] app/testpmd: replace comma operator with bracket Stephen Hemminger
2025-08-14 21:28 ` [PATCH v2 0/6] Enable warnings about use of comma operator Stephen Hemminger
2025-08-14 21:28   ` Stephen Hemminger [this message]
2025-08-14 21:28   ` [PATCH v2 2/6] ipsec: replace unnecessary " Stephen Hemminger
2025-08-14 21:28   ` [PATCH v2 3/6] graph: " Stephen Hemminger
2025-08-14 21:28   ` [PATCH v2 4/6] test: replace unnecessary comma operators Stephen Hemminger
2025-08-14 21:28   ` [PATCH v2 5/6] app/testpmd: replace comma operator with bracket Stephen Hemminger
2025-08-14 21:28   ` [PATCH v2 6/6] config: enable comma warnings Stephen Hemminger
2025-08-15  0:30   ` [PATCH v2 0/6] Enable warnings about use of comma operator fengchengwen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250814212901.88863-2-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=roretzla@linux.microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).