1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #8060 from miri64/gnrc_lwmac/fix/cppcheck

gnrc_lwmac: fix issues reported by cppcheck
This commit is contained in:
Koen Zandberg 2017-11-16 15:52:50 +01:00 committed by GitHub
commit 4fe37541f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -524,8 +524,6 @@ static void _rx_management(gnrc_netif2_t *netif)
static void _tx_management_stopped(gnrc_netif2_t *netif) static void _tx_management_stopped(gnrc_netif2_t *netif)
{ {
gnrc_pktsnip_t *pkt;
/* If there is packet remaining for retransmission, /* If there is packet remaining for retransmission,
* retransmit it (i.e., the retransmission scheme of LWMAC). */ * retransmit it (i.e., the retransmission scheme of LWMAC). */
if (netif->mac.tx.packet != NULL) { if (netif->mac.tx.packet != NULL) {
@ -536,6 +534,8 @@ static void _tx_management_stopped(gnrc_netif2_t *netif)
gnrc_lwmac_tx_update(netif); gnrc_lwmac_tx_update(netif);
} }
else { else {
gnrc_pktsnip_t *pkt;
if ((pkt = gnrc_priority_pktqueue_pop( if ((pkt = gnrc_priority_pktqueue_pop(
&netif->mac.tx.current_neighbor->queue))) { &netif->mac.tx.current_neighbor->queue))) {
netif->mac.tx.tx_retry_count = 0; netif->mac.tx.tx_retry_count = 0;

View File

@ -378,6 +378,7 @@ static bool _send_data(gnrc_netif2_t *netif)
gnrc_pktsnip_t *pkt = netif->mac.tx.packet; gnrc_pktsnip_t *pkt = netif->mac.tx.packet;
gnrc_pktsnip_t *pkt_payload; gnrc_pktsnip_t *pkt_payload;
assert(pkt != NULL);
/* Enable Auto ACK again */ /* Enable Auto ACK again */
netopt_enable_t autoack = NETOPT_ENABLE; netopt_enable_t autoack = NETOPT_ENABLE;
netif->dev->driver->set(netif->dev, NETOPT_AUTOACK, netif->dev->driver->set(netif->dev, NETOPT_AUTOACK,
@ -451,9 +452,7 @@ static bool _send_data(gnrc_netif2_t *netif)
int res = _gnrc_lwmac_transmit(netif, pkt); int res = _gnrc_lwmac_transmit(netif, pkt);
if (res < 0) { if (res < 0) {
LOG_ERROR("ERROR: [LWMAC-tx] Send data failed."); LOG_ERROR("ERROR: [LWMAC-tx] Send data failed.");
if (pkt != NULL) { gnrc_pktbuf_release(pkt);
gnrc_pktbuf_release(pkt);
}
/* clear packet point to avoid TX retry */ /* clear packet point to avoid TX retry */
netif->mac.tx.packet = NULL; netif->mac.tx.packet = NULL;
return false; return false;