drivers/ieee802154: Fix UPIPE driver at boot

Before it is initialized, upipe_dev is not set. Fixes this issue:

SeaBIOS (version rel-1.11.2-0-gf9626ccb91-prebuilt.qemu-project.org)
Booting from ROM..***** CPU Page Fault (error code 0x00000000)
Supervisor thread read address 0x00000008
PDE: 0x025 Present, Read-only, User, Execute Enabled
PTE: 0x00 Non-present, Read-only, Supervisor, Execute Enabled
Current thread ID = 0x00401a40
eax: 0x00000000, ebx: 0x0040c668, ecx: 0x00000001, edx: 0x000002f8
esi: 0x0040ac5b, edi: 0x0040ac38, ebp: 0x0040b4a8, esp: 0x0040b498
eflags: 0x00000202 cs: 0x0008
call trace:
eip: 0x00008651
     0x000082a3 (0x400a8d)
     0x00008b12 (0x40c668)
     0x00008632

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2019-01-07 13:05:18 +01:00 committed by Jukka Rissanen
commit 88b2535e0d

View file

@ -100,14 +100,14 @@ static bool received_dest_addr_matched(u8_t *rx_buffer)
static u8_t *upipe_rx(u8_t *buf, size_t *off)
{
struct upipe_context *upipe = upipe_dev->driver_data;
struct net_pkt *pkt = NULL;
struct net_buf *frag = NULL;
struct upipe_context *upipe;
if (!upipe_dev) {
goto done;
}
upipe = upipe_dev->driver_data;
if (!upipe->rx && *buf == UART_PIPE_RADIO_15_4_FRAME_TYPE) {
upipe->rx = true;
goto done;
@ -125,6 +125,8 @@ static u8_t *upipe_rx(u8_t *buf, size_t *off)
upipe->rx_buf[upipe->rx_off++] = *buf;
if (upipe->rx_len == upipe->rx_off) {
struct net_buf *frag;
pkt = net_pkt_get_reserve_rx(K_NO_WAIT);
if (!pkt) {
LOG_DBG("No pkt available");