linux/drivers/net/wireless/ath/carl9170
Christian Lamparter 1981e881fd carl9170: explain why sta cannot be NULL for ampdus
Dan Carpenter reported that smatch detected a potential
problem with the code [1]:
 drivers/net/wireless/ath/carl9170/tx.c:1488 carl9170_op_tx()
  error: we previously assumed 'sta' could be null (see line 1482)

 drivers/net/wireless/ath/carl9170/tx.c
  1482  if (sta) {
           ^^^^^ New check.
  [...]
  1485  }
  1487  if (info->flags & IEEE80211_TX_CTL_AMPDU) {
  1488    run = carl9170_tx_ampdu_queue(ar, sta, skb);
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   Old dereference of "sta" inside the call to carl9170_tx_ampdu_queue().

A range of solutions have been discussed in [2] and
we agreed on the following: "
> we might as well add a comment to carl9170_tx_ampdu_queue
> and explain the situation [in a way that's obvious to a
> human reader]. This way we can save the "if"... which is
> a small win since carl9170_op_tx is sort of a hot-path.
Putting a comment there is fine. Without the comment
it's easy for a human reader to get confused why the
check is there. So long as humans can read the code,
that's all that matters."

[1] <http://www.spinics.net/lists/linux-wireless/msg94526.html>
[2] <http://www.spinics.net/lists/linux-kernel-janitors/msg14953.html>

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-12-06 14:58:55 -05:00
..
carl9170.h carl9170: fix sleep in softirq context 2012-10-08 15:06:04 -04:00
cmd.c wireless: Remove casts to same type 2012-06-06 09:31:33 -07:00
cmd.h wireless: Remove unnecessary ; from while (0) macros 2012-04-11 16:23:56 -04:00
debug.c simple_open: automatically convert to simple_open() 2012-04-05 15:25:50 -07:00
debug.h
eeprom.h
fw.c carl9170: kill MODULE_VERSION 2012-11-14 14:55:34 -05:00
fwcmd.h carl9170: import updated firmware headers 2011-08-24 14:41:42 -04:00
fwdesc.h carl9170: import 1.9.6 firmware headers 2012-07-11 15:38:26 -04:00
hw.h carl9170 firmware: update firmware headers 2011-07-18 14:29:43 -04:00
Kconfig wireless: allow Atheros card to not depend on ath.ko 2012-11-30 13:38:16 -05:00
led.c carl9170: fix formatting issues found by checkpatch 2011-07-15 13:38:34 -04:00
mac.c carl9170: fix spurious transmissions in sniffer mode 2012-10-29 15:18:04 -04:00
main.c carl9170: fix sleep in softirq context 2012-10-08 15:06:04 -04:00
Makefile
phy.c carl9170: allow users to lower output power level 2012-01-27 14:56:57 -05:00
phy.h
rx.c carl9170: fix signal strength reporting issues 2012-12-03 13:52:00 -05:00
tx.c carl9170: explain why sta cannot be NULL for ampdus 2012-12-06 14:58:55 -05:00
usb.c carl9170: handle traps from firmware loader 2012-10-19 15:53:20 -04:00
version.h carl9170: import 1.9.6 firmware headers 2012-07-11 15:38:26 -04:00
wlan.h carl9170: import 1.9.4 firmware headers 2011-07-05 15:26:51 -04:00