* [PATCH] net/sched: avoid unused-label warning
@ 2019-03-04 20:40 Arnd Bergmann
2019-03-04 21:24 ` David Miller
2019-03-06 0:28 ` Cong Wang
0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2019-03-04 20:40 UTC (permalink / raw)
To: Jamal Hadi Salim, Cong Wang, Jiri Pirko, David S. Miller
Cc: Arnd Bergmann, Vlad Buslov, Marcelo Ricardo Leitner,
Davide Caratti, Simon Horman, Adi Nissim, wenxu, netdev,
linux-kernel
The label is only used from inside the #ifdef and should be
hidden the same way, to avoid this warning:
net/sched/act_tunnel_key.c: In function 'tunnel_key_init':
net/sched/act_tunnel_key.c:389:1: error: label 'release_tun_meta' defined but not used [-Werror=unused-label]
release_tun_meta:
Fixes: 41411e2fd6b8 ("net/sched: act_tunnel_key: Add dst_cache support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
net/sched/act_tunnel_key.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
index 2a5f215ae876..3beb4717d3b7 100644
--- a/net/sched/act_tunnel_key.c
+++ b/net/sched/act_tunnel_key.c
@@ -392,8 +392,8 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
#ifdef CONFIG_DST_CACHE
if (metadata)
dst_cache_destroy(&metadata->u.tun_info.dst_cache);
-#endif
release_tun_meta:
+#endif
if (metadata)
dst_release(&metadata->dst);
--
2.20.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net/sched: avoid unused-label warning
2019-03-04 20:40 [PATCH] net/sched: avoid unused-label warning Arnd Bergmann
@ 2019-03-04 21:24 ` David Miller
2019-03-06 0:28 ` Cong Wang
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2019-03-04 21:24 UTC (permalink / raw)
To: arnd
Cc: jhs, xiyou.wangcong, jiri, vladbu, marcelo.leitner, dcaratti,
simon.horman, adin, wenxu, netdev, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Date: Mon, 4 Mar 2019 21:40:32 +0100
> The label is only used from inside the #ifdef and should be
> hidden the same way, to avoid this warning:
>
> net/sched/act_tunnel_key.c: In function 'tunnel_key_init':
> net/sched/act_tunnel_key.c:389:1: error: label 'release_tun_meta' defined but not used [-Werror=unused-label]
> release_tun_meta:
>
> Fixes: 41411e2fd6b8 ("net/sched: act_tunnel_key: Add dst_cache support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net/sched: avoid unused-label warning
2019-03-04 20:40 [PATCH] net/sched: avoid unused-label warning Arnd Bergmann
2019-03-04 21:24 ` David Miller
@ 2019-03-06 0:28 ` Cong Wang
2019-03-06 8:32 ` Arnd Bergmann
1 sibling, 1 reply; 4+ messages in thread
From: Cong Wang @ 2019-03-06 0:28 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Jamal Hadi Salim, Jiri Pirko, David S. Miller, Vlad Buslov,
Marcelo Ricardo Leitner, Davide Caratti, Simon Horman,
Adi Nissim, wenxu, Linux Kernel Network Developers, LKML
On Mon, Mar 4, 2019 at 12:40 PM Arnd Bergmann <arnd@arndb.de> wrote:
>
> The label is only used from inside the #ifdef and should be
> hidden the same way, to avoid this warning:
>
> net/sched/act_tunnel_key.c: In function 'tunnel_key_init':
> net/sched/act_tunnel_key.c:389:1: error: label 'release_tun_meta' defined but not used [-Werror=unused-label]
> release_tun_meta:
>
> Fixes: 41411e2fd6b8 ("net/sched: act_tunnel_key: Add dst_cache support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> net/sched/act_tunnel_key.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
> index 2a5f215ae876..3beb4717d3b7 100644
> --- a/net/sched/act_tunnel_key.c
> +++ b/net/sched/act_tunnel_key.c
> @@ -392,8 +392,8 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
> #ifdef CONFIG_DST_CACHE
> if (metadata)
> dst_cache_destroy(&metadata->u.tun_info.dst_cache);
> -#endif
> release_tun_meta:
> +#endif
These #ifdef's are ugly, either we should select DST_CACHE
or provide a nop for these dst_cache_*() APIs when it is not
enabled.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net/sched: avoid unused-label warning
2019-03-06 0:28 ` Cong Wang
@ 2019-03-06 8:32 ` Arnd Bergmann
0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2019-03-06 8:32 UTC (permalink / raw)
To: Cong Wang
Cc: Jamal Hadi Salim, Jiri Pirko, David S. Miller, Vlad Buslov,
Marcelo Ricardo Leitner, Davide Caratti, Simon Horman,
Adi Nissim, wenxu, Linux Kernel Network Developers, LKML
On Wed, Mar 6, 2019 at 1:28 AM Cong Wang <xiyou.wangcong@gmail.com> wrote:
> On Mon, Mar 4, 2019 at 12:40 PM Arnd Bergmann <arnd@arndb.de> wrote:
> > diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
> > index 2a5f215ae876..3beb4717d3b7 100644
> > --- a/net/sched/act_tunnel_key.c
> > +++ b/net/sched/act_tunnel_key.c
> > @@ -392,8 +392,8 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
> > #ifdef CONFIG_DST_CACHE
> > if (metadata)
> > dst_cache_destroy(&metadata->u.tun_info.dst_cache);
> > -#endif
> > release_tun_meta:
> > +#endif
>
> These #ifdef's are ugly, either we should select DST_CACHE
> or provide a nop for these dst_cache_*() APIs when it is not
> enabled.
I agree that would be nicer, or alternatively convert the preprocessor
conditionals to C conditionals like
diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
index 3beb4717d3b7..586343a5accc 100644
--- a/net/sched/act_tunnel_key.c
+++ b/net/sched/act_tunnel_key.c
@@ -327,11 +327,11 @@ static int tunnel_key_init(struct net *net,
struct nlattr *nla,
goto err_out;
}
-#ifdef CONFIG_DST_CACHE
- ret = dst_cache_init(&metadata->u.tun_info.dst_cache,
GFP_KERNEL);
- if (ret)
- goto release_tun_meta;
-#endif
+ if (IS_ENABLED(CONFIG_DST_CACHE)) {
+ ret =
dst_cache_init(&metadata->u.tun_info.dst_cache, GFP_KERNEL);
+ if (ret)
+ goto release_tun_meta;
+ }
if (opts_len) {
ret = tunnel_key_opts_set(tb[TCA_TUNNEL_KEY_ENC_OPTS],
@@ -389,11 +389,9 @@ static int tunnel_key_init(struct net *net,
struct nlattr *nla,
return ret;
release_dst_cache:
-#ifdef CONFIG_DST_CACHE
if (metadata)
dst_cache_destroy(&metadata->u.tun_info.dst_cache);
release_tun_meta:
-#endif
if (metadata)
dst_release(&metadata->dst);
Usually, you'd want to do that consistently though, and change all the
related checks at the same time, so I would keep that separate from
the trivial bugfix.
Arnd
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-03-06 8:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-04 20:40 [PATCH] net/sched: avoid unused-label warning Arnd Bergmann
2019-03-04 21:24 ` David Miller
2019-03-06 0:28 ` Cong Wang
2019-03-06 8:32 ` Arnd Bergmann
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).