From: Ferruh Yigit Date: Fri, 14 Oct 2016 16:41:54 +0000 (+0100) Subject: kni: fix build with kernel < 3.1 X-Git-Tag: spdx-start~5509 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=17351105097ffc13e42e6b2b9b0ee6c6c2cb802d;p=dpdk.git kni: fix build with kernel < 3.1 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 --- diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c index 3303d9b6bc..497db9bd3d 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