Skip to content

Commit 61004d1

Browse files
louis-peenskuba-moo
authored andcommitted
nfp: flower: fix 'variable 'flow6' set but not used'
Kernel test robot reported an issue after a recent patch about an unused variable when CONFIG_IPV6 is disabled. Move the variable declaration to be inside the #ifdef, and do a bit more cleanup. There is no need to use a temporary ipv6 bool value, it is just checked once, remove the extra variable and just do the check directly. Fixes: 9d5447e ("nfp: flower: fixup ipv6/ipv4 route lookup for neigh events") Reported-by: kernel test robot <[email protected]> Signed-off-by: Louis Peens <[email protected]> Signed-off-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent ecd17a8 commit 61004d1

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -563,12 +563,9 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event,
563563
{
564564
struct nfp_flower_priv *app_priv;
565565
struct netevent_redirect *redir;
566-
struct flowi4 flow4 = {};
567-
struct flowi6 flow6 = {};
568566
struct neighbour *n;
569567
struct nfp_app *app;
570568
bool neigh_invalid;
571-
bool ipv6 = false;
572569
int err;
573570

574571
switch (event) {
@@ -583,16 +580,8 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event,
583580
return NOTIFY_DONE;
584581
}
585582

586-
if (n->tbl->family == AF_INET6)
587-
ipv6 = true;
588-
589583
neigh_invalid = !(n->nud_state & NUD_VALID) || n->dead;
590584

591-
if (ipv6)
592-
flow6.daddr = *(struct in6_addr *)n->primary_key;
593-
else
594-
flow4.daddr = *(__be32 *)n->primary_key;
595-
596585
app_priv = container_of(nb, struct nfp_flower_priv, tun.neigh_nb);
597586
app = app_priv->app;
598587

@@ -601,8 +590,11 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event,
601590
return NOTIFY_DONE;
602591

603592
#if IS_ENABLED(CONFIG_INET)
604-
if (ipv6) {
593+
if (n->tbl->family == AF_INET6) {
605594
#if IS_ENABLED(CONFIG_IPV6)
595+
struct flowi6 flow6 = {};
596+
597+
flow6.daddr = *(struct in6_addr *)n->primary_key;
606598
if (!neigh_invalid) {
607599
struct dst_entry *dst;
608600
/* Use ipv6_dst_lookup_flow to populate flow6->saddr
@@ -623,6 +615,9 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event,
623615
return NOTIFY_DONE;
624616
#endif /* CONFIG_IPV6 */
625617
} else {
618+
struct flowi4 flow4 = {};
619+
620+
flow4.daddr = *(__be32 *)n->primary_key;
626621
if (!neigh_invalid) {
627622
struct rtable *rt;
628623
/* Use ip_route_output_key to populate flow4->saddr and

0 commit comments

Comments
 (0)