drivers: ieee802154: fix freeing Rx buffer

This commit fixes a bug where an already received Rx frame could not be
processed by the IEEE 802.15.4 driver.

In the current implementation, buffer is marked as free and released to
the buffer pool after `nrf_802154_buffer_free_raw` finishes executing.
However, delays caused by thread scheduling might result in a new frame
being already received and provided to the driver before
`nrf_802154_buffer_free_raw` returns. Such a situation ends in an
assertion now.

This commit changes that behavior by marking the buffer as free before
calling `nrf_802154_buffer_free_raw`.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
1 file changed