diff options
author | Alan Ott <alan@signal11.us> | 2013-10-06 05:52:22 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-10-08 21:32:13 +0200 |
commit | 9757f1d2e0b4e7ff59e76c2fadbf819e18f3f884 (patch) | |
tree | a279cc4966286b7ee5a9ac5775e3a9747da66936 /drivers/net/ieee802154 | |
parent | Merge branch '6lowpan' (diff) | |
download | linux-9757f1d2e0b4e7ff59e76c2fadbf819e18f3f884.tar.xz linux-9757f1d2e0b4e7ff59e76c2fadbf819e18f3f884.zip |
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: Alan Ott <alan@signal11.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ieee802154')
-rw-r--r-- | drivers/net/ieee802154/mrf24j40.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c index 42e6deee6db5..66bb4ceaabe8 100644 --- a/drivers/net/ieee802154/mrf24j40.c +++ b/drivers/net/ieee802154/mrf24j40.c @@ -344,6 +344,8 @@ static int mrf24j40_tx(struct ieee802154_dev *dev, struct sk_buff *skb) if (ret) goto err; + INIT_COMPLETION(devrec->tx_complete); + /* Set TXNTRIG bit of TXNCON to send packet */ ret = read_short_reg(devrec, REG_TXNCON, &val); if (ret) @@ -354,8 +356,6 @@ static int mrf24j40_tx(struct ieee802154_dev *dev, struct sk_buff *skb) val |= 0x4; write_short_reg(devrec, REG_TXNCON, val); - INIT_COMPLETION(devrec->tx_complete); - /* Wait for the device to send the TX complete interrupt. */ ret = wait_for_completion_interruptible_timeout( &devrec->tx_complete, |