[dpdk-dev,v3,07/24] rte_spinlock.h: stack declarations before code

Message ID 152609035743.121661.16417462726686469432.stgit@localhost.localdomain (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Andy Green May 12, 2018, 1:59 a.m. UTC
  /projects/lagopus/src/dpdk/build/include/rte_spinlock.h:
In function 'rte_try_tm':
/projects/lagopus/src/dpdk/build/include/rte_spinlock.h:82:2:
warning: ISO C90 forbids mixed declarations and code
[-Wdeclaration-after-statement]
  int retries = RTE_RTM_MAX_RETRIES;

Signed-off-by: Andy Green <andy@warmcat.com>
---
 .../common/include/arch/x86/rte_spinlock.h         |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Thomas Monjalon May 13, 2018, 8:42 p.m. UTC | #1
12/05/2018 03:59, Andy Green:
> /projects/lagopus/src/dpdk/build/include/rte_spinlock.h:
> In function 'rte_try_tm':
> /projects/lagopus/src/dpdk/build/include/rte_spinlock.h:82:2:
> warning: ISO C90 forbids mixed declarations and code
> [-Wdeclaration-after-statement]
>   int retries = RTE_RTM_MAX_RETRIES;

    Fixes: ba7468997ea6 ("spinlock: add HTM lock elision for x86")
    Cc: stable@dpdk.org

> Signed-off-by: Andy Green <andy@warmcat.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h
index 4b16887ea..60321da02 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h
@@ -76,10 +76,12 @@  static inline int rte_tm_supported(void)
 static inline int
 rte_try_tm(volatile int *lock)
 {
+	int retries;
+
 	if (!rte_rtm_supported)
 		return 0;
 
-	int retries = RTE_RTM_MAX_RETRIES;
+	retries = RTE_RTM_MAX_RETRIES;
 
 	while (likely(retries--)) {