Commit 9757f1d2 authored by Alan Ott's avatar Alan Ott Committed by David S. Miller

mrf24j40: Move INIT_COMPLETION() to before packet transmission

This avoids a race condition where complete(tx_complete) could be called
before tx_complete is initialized.
Signed-off-by: default avatarAlan Ott <alan@signal11.us>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8cc27d17
...@@ -344,6 +344,8 @@ static int mrf24j40_tx(struct ieee802154_dev *dev, struct sk_buff *skb) ...@@ -344,6 +344,8 @@ static int mrf24j40_tx(struct ieee802154_dev *dev, struct sk_buff *skb)
if (ret) if (ret)
goto err; goto err;
INIT_COMPLETION(devrec->tx_complete);
/* Set TXNTRIG bit of TXNCON to send packet */ /* Set TXNTRIG bit of TXNCON to send packet */
ret = read_short_reg(devrec, REG_TXNCON, &val); ret = read_short_reg(devrec, REG_TXNCON, &val);
if (ret) if (ret)
...@@ -354,8 +356,6 @@ static int mrf24j40_tx(struct ieee802154_dev *dev, struct sk_buff *skb) ...@@ -354,8 +356,6 @@ static int mrf24j40_tx(struct ieee802154_dev *dev, struct sk_buff *skb)
val |= 0x4; val |= 0x4;
write_short_reg(devrec, REG_TXNCON, val); write_short_reg(devrec, REG_TXNCON, val);
INIT_COMPLETION(devrec->tx_complete);
/* Wait for the device to send the TX complete interrupt. */ /* Wait for the device to send the TX complete interrupt. */
ret = wait_for_completion_interruptible_timeout( ret = wait_for_completion_interruptible_timeout(
&devrec->tx_complete, &devrec->tx_complete,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment