From f7f18e92a51276f1e23a0595f59615f79323b358 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sat, 12 May 2018 09:59:17 +0800 Subject: [PATCH] spinlock/x86: move stack declaration before code In function 'rte_try_tm': 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 Reviewed-by: Stephen Hemminger --- lib/librte_eal/common/include/arch/x86/rte_spinlock.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 4b16887ead..60321da024 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--)) { -- 2.20.1