fix kernel panic
This commit is contained in:
parent
a73edd885d
commit
e90f154cac
|
@ -441,7 +441,7 @@ exit_busy:
|
||||||
|
|
||||||
static void sx127x_poll_work(struct work_struct *work)
|
static void sx127x_poll_work(struct work_struct *work)
|
||||||
{
|
{
|
||||||
u8 ack_flags, lqi, mode, read_flags, rx_base, *rx_data, rx_length;
|
u8 ack_flags, lqi, mode, read_flags, rx_base, *rx_data, rx_length = 0;
|
||||||
bool do_rx = false, was_busy = false;
|
bool do_rx = false, was_busy = false;
|
||||||
unsigned long spin_irq;
|
unsigned long spin_irq;
|
||||||
struct sx127x *hw = container_of(work, struct sx127x, poll_work);
|
struct sx127x *hw = container_of(work, struct sx127x, poll_work);
|
||||||
|
@ -492,14 +492,18 @@ static void sx127x_poll_work(struct work_struct *work)
|
||||||
if (sx127x_reg_write(hw, SX127X_REG_FIFO_ADDR_PTR, rx_base) < 0)
|
if (sx127x_reg_write(hw, SX127X_REG_FIFO_ADDR_PTR, rx_base) < 0)
|
||||||
goto exit_busy;
|
goto exit_busy;
|
||||||
|
|
||||||
|
if (rx_length <= IEEE802154_MTU) {
|
||||||
rx_skb = dev_alloc_skb(IEEE802154_MTU);
|
rx_skb = dev_alloc_skb(IEEE802154_MTU);
|
||||||
if (!rx_skb)
|
if (!rx_skb)
|
||||||
goto exit_busy;
|
goto exit_busy;
|
||||||
|
|
||||||
rx_data = skb_put(rx_skb, rx_length);
|
rx_data = skb_put(rx_skb, rx_length);
|
||||||
|
|
||||||
while (rx_length--)
|
while (rx_length--)
|
||||||
if (sx127x_reg_read(hw, SX127X_REG_FIFO, rx_data++) < 0)
|
if (sx127x_reg_read(hw, SX127X_REG_FIFO, rx_data++) < 0)
|
||||||
goto exit_busy;
|
goto exit_busy;
|
||||||
|
} else
|
||||||
|
dev_err(&hw->spi->dev, "%s: rx_length overflow: %u > IEEE802154_MTU\n", __func__, rx_length);
|
||||||
|
|
||||||
if (sx127x_reg_write(hw, SX127X_REG_FIFO_RX_BASE_ADDR, SX127X_FIFO_RX_BASE_ADDRESS) < 0)
|
if (sx127x_reg_write(hw, SX127X_REG_FIFO_RX_BASE_ADDR, SX127X_FIFO_RX_BASE_ADDRESS) < 0)
|
||||||
goto exit_busy;
|
goto exit_busy;
|
||||||
|
|
Loading…
Reference in a new issue