Skip to content

Commit 20df28f

Browse files
leitaokuba-moo
authored andcommitted
net/ipv6: resolve warning in ip6_fib.c
In some configurations, the 'iter' variable in function fib6_repair_tree() is unused, resulting the following warning when compiled with W=1. net/ipv6/ip6_fib.c:1781:6: warning: variable 'iter' set but not used [-Wunused-but-set-variable] 1781 | int iter = 0; | ^ It is unclear what is the advantage of this RT6_TRACE() macro[1], since users can control pr_debug() in runtime, which is better than at compilation time. pr_debug() has no overhead when disabled. Remove the RT6_TRACE() in favor of simple pr_debug() helpers. [1] Link: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Breno Leitao <[email protected]> Reviewed-by: David Ahern <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent a6348a7 commit 20df28f

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

include/net/ip6_fib.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@
3030

3131
#define RT6_DEBUG 2
3232

33-
#if RT6_DEBUG >= 3
34-
#define RT6_TRACE(x...) pr_debug(x)
35-
#else
36-
#define RT6_TRACE(x...) do { ; } while (0)
37-
#endif
38-
3933
struct rt6_info;
4034
struct fib6_info;
4135

net/ipv6/ip6_fib.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,7 +1801,7 @@ static struct fib6_node *fib6_repair_tree(struct net *net,
18011801
lockdep_is_held(&table->tb6_lock));
18021802
struct fib6_info *new_fn_leaf;
18031803

1804-
RT6_TRACE("fixing tree: plen=%d iter=%d\n", fn->fn_bit, iter);
1804+
pr_debug("fixing tree: plen=%d iter=%d\n", fn->fn_bit, iter);
18051805
iter++;
18061806

18071807
WARN_ON(fn->fn_flags & RTN_RTINFO);
@@ -1864,18 +1864,21 @@ static struct fib6_node *fib6_repair_tree(struct net *net,
18641864
FOR_WALKERS(net, w) {
18651865
if (!child) {
18661866
if (w->node == fn) {
1867-
RT6_TRACE("W %p adjusted by delnode 1, s=%d/%d\n", w, w->state, nstate);
1867+
pr_debug("W %p adjusted by delnode 1, s=%d/%d\n",
1868+
w, w->state, nstate);
18681869
w->node = pn;
18691870
w->state = nstate;
18701871
}
18711872
} else {
18721873
if (w->node == fn) {
18731874
w->node = child;
18741875
if (children&2) {
1875-
RT6_TRACE("W %p adjusted by delnode 2, s=%d\n", w, w->state);
1876+
pr_debug("W %p adjusted by delnode 2, s=%d\n",
1877+
w, w->state);
18761878
w->state = w->state >= FWS_R ? FWS_U : FWS_INIT;
18771879
} else {
1878-
RT6_TRACE("W %p adjusted by delnode 2, s=%d\n", w, w->state);
1880+
pr_debug("W %p adjusted by delnode 2, s=%d\n",
1881+
w, w->state);
18791882
w->state = w->state >= FWS_C ? FWS_U : FWS_INIT;
18801883
}
18811884
}
@@ -1951,7 +1954,7 @@ static void fib6_del_route(struct fib6_table *table, struct fib6_node *fn,
19511954
read_lock(&net->ipv6.fib6_walker_lock);
19521955
FOR_WALKERS(net, w) {
19531956
if (w->state == FWS_C && w->leaf == rt) {
1954-
RT6_TRACE("walker %p adjusted by delroute\n", w);
1957+
pr_debug("walker %p adjusted by delroute\n", w);
19551958
w->leaf = rcu_dereference_protected(rt->fib6_next,
19561959
lockdep_is_held(&table->tb6_lock));
19571960
if (!w->leaf)
@@ -2289,7 +2292,7 @@ static int fib6_age(struct fib6_info *rt, void *arg)
22892292

22902293
if (rt->fib6_flags & RTF_EXPIRES && rt->expires) {
22912294
if (time_after(now, rt->expires)) {
2292-
RT6_TRACE("expiring %p\n", rt);
2295+
pr_debug("expiring %p\n", rt);
22932296
return -1;
22942297
}
22952298
gc_args->more++;

net/ipv6/route.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2085,12 +2085,12 @@ static void rt6_age_examine_exception(struct rt6_exception_bucket *bucket,
20852085
*/
20862086
if (!(rt->rt6i_flags & RTF_EXPIRES)) {
20872087
if (time_after_eq(now, rt->dst.lastuse + gc_args->timeout)) {
2088-
RT6_TRACE("aging clone %p\n", rt);
2088+
pr_debug("aging clone %p\n", rt);
20892089
rt6_remove_exception(bucket, rt6_ex);
20902090
return;
20912091
}
20922092
} else if (time_after(jiffies, rt->dst.expires)) {
2093-
RT6_TRACE("purging expired route %p\n", rt);
2093+
pr_debug("purging expired route %p\n", rt);
20942094
rt6_remove_exception(bucket, rt6_ex);
20952095
return;
20962096
}
@@ -2101,8 +2101,8 @@ static void rt6_age_examine_exception(struct rt6_exception_bucket *bucket,
21012101
neigh = __ipv6_neigh_lookup_noref(rt->dst.dev, &rt->rt6i_gateway);
21022102

21032103
if (!(neigh && (neigh->flags & NTF_ROUTER))) {
2104-
RT6_TRACE("purging route %p via non-router but gateway\n",
2105-
rt);
2104+
pr_debug("purging route %p via non-router but gateway\n",
2105+
rt);
21062106
rt6_remove_exception(bucket, rt6_ex);
21072107
return;
21082108
}

0 commit comments

Comments
 (0)