From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id ABFD258D4 for ; Fri, 14 Oct 2016 18:42:10 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP; 14 Oct 2016 09:41:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,493,1473145200"; d="scan'208";a="772659263" Received: from sivswdev02.ir.intel.com ([10.237.217.46]) by FMSMGA003.fm.intel.com with ESMTP; 14 Oct 2016 09:41:57 -0700 From: Ferruh Yigit To: dev@dpdk.org Cc: Ferruh Yigit , Thomas Monjalon Date: Fri, 14 Oct 2016 17:41:54 +0100 Message-Id: <20161014164154.26015-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <7457537.60EcOXE9kS@xps13> References: <7457537.60EcOXE9kS@xps13> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2] kni: fix unused variable compile error X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 16:42:11 -0000 compile error: CC [M] .../lib/librte_eal/linuxapp/kni/kni_misc.o cc1: warnings being treated as errors .../lib/librte_eal/linuxapp/kni/kni_misc.c: In function ‘kni_exit_net’: .../lib/librte_eal/linuxapp/kni/kni_misc.c:113:18: error: unused variable ‘knet’ For kernel versions < v3.1 mutex_destroy() is a macro and does nothing, this cause an unused variable warning for knet which used in the mutex_destroy() mutex_destroy() converted into static inline function with commit: Linux: 4582c0a4866e ("mutex: Make mutex_destroy() an inline function") To fix the warning unused attribute added to the knet variable. Fixes: 93a298b34e1b ("kni: support core id parameter in single threaded mode") Signed-off-by: Ferruh Yigit --- v2: * updated commit log with more details on Linux version that issue occurs --- lib/librte_eal/linuxapp/kni/kni_misc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c index 3303d9b..497db9b 100644 --- a/lib/librte_eal/linuxapp/kni/kni_misc.c +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c @@ -110,9 +110,11 @@ kni_init_net(struct net *net) static void __net_exit kni_exit_net(struct net *net) { - struct kni_net *knet = net_generic(net, kni_net_id); + struct kni_net *knet __maybe_unused; + knet = net_generic(net, kni_net_id); mutex_destroy(&knet->kni_kthread_lock); + #ifndef HAVE_SIMPLIFIED_PERNET_OPERATIONS kfree(knet); #endif -- 2.7.4