From 9129ea7399f064957a1d9eb3b0e8d1e302c9eb15 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Tue, 17 Sep 2019 19:02:47 +0200 Subject: [PATCH] esp_now: fix unused variable warning esp_now_pkt_hdr_t *hdr is only used if gnrc_sixlowpan is used, so move it into the according #ifdef fixes #12257 --- cpu/esp_common/esp-now/esp_now_gnrc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpu/esp_common/esp-now/esp_now_gnrc.c b/cpu/esp_common/esp-now/esp_now_gnrc.c index 5300280d5013..8c40bbfb5a1f 100644 --- a/cpu/esp_common/esp-now/esp_now_gnrc.c +++ b/cpu/esp_common/esp-now/esp_now_gnrc.c @@ -147,7 +147,6 @@ static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif) pkt = mac_hdr; goto err; } - esp_now_pkt_hdr_t *hdr = (esp_now_pkt_hdr_t*)esp_hdr->data; #ifdef MODULE_L2FILTER if (!l2filter_pass(dev->filter, mac_hdr->data, ESP_NOW_ADDR_LEN)) { @@ -160,6 +159,8 @@ static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif) pkt->type = GNRC_NETTYPE_UNDEF; #ifdef MODULE_GNRC_SIXLOWPAN + esp_now_pkt_hdr_t *hdr = (esp_now_pkt_hdr_t*)esp_hdr->data; + if (hdr->flags & ESP_NOW_PKT_HDR_FLAG_SIXLO) { pkt->type = GNRC_NETTYPE_SIXLOWPAN; }