Skip to contentSkip to conversation

net: core: fix unused variable sparse warning

PATCH In review Cong Ding 4 participants 5 messages Dec 7, 2012

Subsystems (2)
lore
Share & tools
lore

Cong Ding

author
#0 lore raw

PATCH 1/1 net: core: fix unused variable sparse warning

the variables zero and unres_qlen_max are only used when CONFIG_SYSCTL is defined, otherwise it causes the following sparse warning when we turn on CONFIG_SYSCTL.

---
 net/core/neighbour.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
net/core/neighbour.c +2 -0
index 36fc692..4a15278 100644
@@ -62,8 +62,10 @@ static void __neigh_notify(struct neighbour *n, int type, int flags);
 static void neigh_update_notify(struct neighbour *neigh);
 static int pneigh_ifdown(struct neigh_table *tbl, struct net_device *dev);
 
+#ifdef CONFIG_SYSCTL
 static int zero;
 static int unres_qlen_max = INT_MAX / SKB_TRUESIZE(ETH_FRAME_LEN);
+#endif
 
 static struct neigh_table *neigh_tables;
 #ifdef CONFIG_PROC_FS
Signature · 1 line
1.7.4.5
author
#1 lore raw
Quoted 3 lines · Cong Ding

the variables zero and unres_qlen_max are only used when CONFIG_SYSCTL is defined, otherwise it causes the following sparse warning when we turn on CONFIG_SYSCTL.

sorry for disturbing again, the sparse warning is
net/core/neighbour.c:65:12: warning: ‘zero’ defined but not used [-Wunused-variable] net/core/neighbour.c:66:12: warning: ‘unres_qlen_max’ defined but not used [-Wunused-variable]

it happens if we turn off CONFIG_SYSCTL.

Quoted 24 lines
---
 net/core/neighbour.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
net/core/neighbour.c +2 -0
index 36fc692..4a15278 100644
@@ -62,8 +62,10 @@ static void __neigh_notify(struct neighbour *n, int type, int flags);
 static void neigh_update_notify(struct neighbour *neigh);
 static int pneigh_ifdown(struct neigh_table *tbl, struct net_device *dev);
 
+#ifdef CONFIG_SYSCTL
 static int zero;
 static int unres_qlen_max = INT_MAX / SKB_TRUESIZE(ETH_FRAME_LEN);
+#endif
 
 static struct neigh_table *neigh_tables;
 #ifdef CONFIG_PROC_FS
Signature · 1 line
1.7.4.5
maintainer
#2 lore raw

From: Cong Ding <[email protected]>
Date: Fri, 7 Dec 2012 00:15:47 +0000

Quoted 9 lines · Cong Ding
Quoted 3 lines

the variables zero and unres_qlen_max are only used when CONFIG_SYSCTL is defined, otherwise it causes the following sparse warning when we turn on CONFIG_SYSCTL.

sorry for disturbing again, the sparse warning is
net/core/neighbour.c:65:12: warning: ‘zero’ defined but not used [-Wunused-variable] net/core/neighbour.c:66:12: warning: ‘unres_qlen_max’ defined but not used [-Wunused-variable]

it happens if we turn off CONFIG_SYSCTL.

A patch for this has already in my tree for nearly a whole day.

#3 lore raw
In reply to Cong Ding

Cong Ding said, at 2012/12/7 8:15:

Quoted 9 lines · Cong Ding
Quoted 3 lines

the variables zero and unres_qlen_max are only used when CONFIG_SYSCTL is defined, otherwise it causes the following sparse warning when we turn on CONFIG_SYSCTL.

sorry for disturbing again, the sparse warning is
net/core/neighbour.c:65:12: warning: ‘zero’ defined but not used [-Wunused-variable] net/core/neighbour.c:66:12: warning: ‘unres_qlen_max’ defined but not used [-Wunused-variable]

it happens if we turn off CONFIG_SYSCTL.

It has been fixed yesterday.
see b93196dc5af7729ff7cc50d3d322ab1a364aa14f

Quoted 30 lines
Quoted 25 lines
---
 net/core/neighbour.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
net/core/neighbour.c +2 -0
index 36fc692..4a15278 100644
@@ -62,8 +62,10 @@ static void __neigh_notify(struct neighbour *n, int type, int flags);
 static void neigh_update_notify(struct neighbour *neigh);
 static int pneigh_ifdown(struct neigh_table *tbl, struct net_device *dev);
 
+#ifdef CONFIG_SYSCTL
 static int zero;
 static int unres_qlen_max = INT_MAX / SKB_TRUESIZE(ETH_FRAME_LEN);
+#endif
 
 static struct neigh_table *neigh_tables;
 #ifdef CONFIG_PROC_FS
Signature · 1 line
1.7.4.5

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Acked-by Shan Wei on v1 1/1
#4 lore raw
In reply to Cong Ding
Quoted 4 lines · Cong Ding

the variables zero and unres_qlen_max are only used when CONFIG_SYSCTL is defined, otherwise it causes the following sparse warning when we turn on CONFIG_SYSCTL.

commit b93196dc5af7729ff7cc50d3d322ab1a364aa14f

Author: Cong Wang <[email protected]>
Date:   Thu Dec 6 10:04:04 2012 +0800

net: fix some compiler warning in net/core/neighbour.c

net/core/neighbour.c:65:12: warning: 'zero' defined but
not used [-Wunused-variable]
net/core/neighbour.c:66:12: warning: 'unres_qlen_max' defined but
not used [-Wunused-variable]

These variables are only used when CONFIG_SYSCTL is defined, so move them under #ifdef CONFIG_SYSCTL.