DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] kni: fix unused variable compile error
@ 2016-10-14 11:24 Ferruh Yigit
  2016-10-14 12:30 ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: Ferruh Yigit @ 2016-10-14 11:24 UTC (permalink / raw)
  To: dev; +Cc: Ferruh Yigit

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 some kernel versions mutex_destroy() is macro and does nothing,
this cause an unused variable warning for knet which used in mutex_destroy

Added unused attribute to the knet variable.

Fixes: 93a298b34e1b ("kni: support core id parameter in single threaded mode")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: fix unused variable compile error
  2016-10-14 11:24 [dpdk-dev] [PATCH] kni: fix unused variable compile error Ferruh Yigit
@ 2016-10-14 12:30 ` Thomas Monjalon
  2016-10-14 16:41   ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2016-10-14 12:30 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev

2016-10-14 12:24, Ferruh Yigit:
> 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 some kernel versions mutex_destroy() is macro and does nothing,
> this cause an unused variable warning for knet which used in mutex_destroy
> 
> Added unused attribute to the knet variable.
> 
> Fixes: 93a298b34e1b ("kni: support core id parameter in single threaded mode")
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

That's why supporting an out-of-tree kernel module is a nightmare.
Compilation breaks everytime with various kernels :(

Please could you tell which Linux versions are affected?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH v2] kni: fix unused variable compile error
  2016-10-14 12:30 ` Thomas Monjalon
@ 2016-10-14 16:41   ` Ferruh Yigit
  2016-10-14 20:22     ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: Ferruh Yigit @ 2016-10-14 16:41 UTC (permalink / raw)
  To: dev; +Cc: Ferruh Yigit, Thomas Monjalon

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 <ferruh.yigit@intel.com>
---

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2] kni: fix unused variable compile error
  2016-10-14 16:41   ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
@ 2016-10-14 20:22     ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2016-10-14 20:22 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev

2016-10-14 17:41, Ferruh Yigit:
> 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 <ferruh.yigit@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-14 20:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-14 11:24 [dpdk-dev] [PATCH] kni: fix unused variable compile error Ferruh Yigit
2016-10-14 12:30 ` Thomas Monjalon
2016-10-14 16:41   ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
2016-10-14 20:22     ` Thomas Monjalon

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).