gnrc_lorawan: fix undefined state when PSDU is NULL
This commit is contained in:
parent
2a1a2ee1d5
commit
71ddd3bd61
@ -176,6 +176,17 @@ void gnrc_lorawan_radio_rx_timeout_cb(gnrc_lorawan_t *mac);
|
||||
*/
|
||||
void gnrc_lorawan_radio_tx_done_cb(gnrc_lorawan_t *mac);
|
||||
|
||||
/**
|
||||
* @brief Indicate the MAC layer reception of a frame went wrong.
|
||||
*
|
||||
* @param[in] mac pointer to the MAC descriptor
|
||||
*/
|
||||
static inline void gnrc_lorawan_radio_rx_error_cb(gnrc_lorawan_t *mac)
|
||||
{
|
||||
/* The failed reception is seen by the MAC layer as an RX timeout */
|
||||
gnrc_lorawan_radio_rx_timeout_cb(mac);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Indicate the MAC layer that the timer was fired
|
||||
*
|
||||
|
||||
@ -180,13 +180,13 @@ static void _rx_done(gnrc_lorawan_t *mac)
|
||||
DEBUG("_recv_lorawan: cannot allocate pktsnip.\n");
|
||||
/* Discard packet on netdev device */
|
||||
dev->driver->recv(dev, NULL, bytes_expected, NULL);
|
||||
gnrc_lorawan_radio_rx_done_cb(mac, NULL, 0);
|
||||
gnrc_lorawan_radio_rx_error_cb(mac);
|
||||
return;
|
||||
}
|
||||
nread = dev->driver->recv(dev, pkt->data, bytes_expected, &rx_info);
|
||||
if (nread <= 0) {
|
||||
gnrc_pktbuf_release(pkt);
|
||||
gnrc_lorawan_radio_rx_done_cb(mac, NULL, 0);
|
||||
gnrc_lorawan_radio_rx_error_cb(mac);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user