Skip to contentSkip to conversation

blackhole_dev: remove unused variable 'ethh' in test_blackholedev_init()

PATCH New Zhen Lei 1 participant 1 message May 19, 2021 Library code

lore
Share & tools
lore

Zhen Lei

author
#0 lore raw

PATCH 1/1 blackhole_dev: remove unused variable 'ethh' in test_blackholedev_init()

GCC reports the following warning with W=1:

lib/test_blackhole_dev.c:32:17: warning:
variable 'ethh' set but not used [-Wunused-but-set-variable]
32 | struct ethhdr *ethh;
| ^~~~

This variable is not used, remove it to fix the warning.

---
 lib/test_blackhole_dev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/test_blackhole_dev.c +1 -2
index 4c40580a99a3..393a0083d027 100644
@@ -29,7 +29,6 @@ static int __init test_blackholedev_init(void)
 {
 	struct ipv6hdr *ip6h;
 	struct sk_buff *skb;
-	struct ethhdr *ethh;
 	struct udphdr *uh;
 	int data_len;
 	int ret;
@@ -61,7 +60,7 @@ static int __init test_blackholedev_init(void)
 	ip6h->saddr = in6addr_loopback;
 	ip6h->daddr = in6addr_loopback;
 	/* Ether */
-	ethh = (struct ethhdr *)skb_push(skb, sizeof(struct ethhdr));
+	(void)skb_push(skb, sizeof(struct ethhdr));
 	skb_set_mac_header(skb, 0);
 
 	skb->protocol = htons(ETH_P_IPV6);
Signature · 1 line
2.25.1