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:
commit
4fe37541f1
@ -524,8 +524,6 @@ static void _rx_management(gnrc_netif2_t *netif)
|
||||
|
||||
static void _tx_management_stopped(gnrc_netif2_t *netif)
|
||||
{
|
||||
gnrc_pktsnip_t *pkt;
|
||||
|
||||
/* If there is packet remaining for retransmission,
|
||||
* retransmit it (i.e., the retransmission scheme of LWMAC). */
|
||||
if (netif->mac.tx.packet != NULL) {
|
||||
@ -536,6 +534,8 @@ static void _tx_management_stopped(gnrc_netif2_t *netif)
|
||||
gnrc_lwmac_tx_update(netif);
|
||||
}
|
||||
else {
|
||||
gnrc_pktsnip_t *pkt;
|
||||
|
||||
if ((pkt = gnrc_priority_pktqueue_pop(
|
||||
&netif->mac.tx.current_neighbor->queue))) {
|
||||
netif->mac.tx.tx_retry_count = 0;
|
||||
|
@ -378,6 +378,7 @@ static bool _send_data(gnrc_netif2_t *netif)
|
||||
gnrc_pktsnip_t *pkt = netif->mac.tx.packet;
|
||||
gnrc_pktsnip_t *pkt_payload;
|
||||
|
||||
assert(pkt != NULL);
|
||||
/* Enable Auto ACK again */
|
||||
netopt_enable_t autoack = NETOPT_ENABLE;
|
||||
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);
|
||||
if (res < 0) {
|
||||
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 */
|
||||
netif->mac.tx.packet = NULL;
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user