diff options
author | Julia Lawall <julia@diku.dk> | 2009-01-09 05:23:10 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-11 03:06:35 -0500 |
commit | 43baa5bb26298e8e268056c58900098ce8454548 (patch) | |
tree | 705280b85ec59628cc1433ec5ea5976da351387b | |
parent | 0397a2648434a65d73564216c4f96945c192ad4a (diff) |
drivers/net/wireless/libertas: move a dereference below a NULL test
In each case, if the NULL test is necessary, then the dereference should be
moved below the NULL test. I have also taken advantage of the availability
of the value of priv->dev in the subsequent calls to netif_stop_queue and
netif_carrier_off.
The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@@
type T;
expression E;
identifier i,fld;
statement S;
@@
- T i = E->fld;
+ T i;
... when != E
when != i
if (E == NULL) S
+ i = E->fld;
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 3dba83679444..4e0007d20030 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -1369,7 +1369,7 @@ EXPORT_SYMBOL_GPL(lbs_start_card); | |||
1369 | 1369 | ||
1370 | void lbs_stop_card(struct lbs_private *priv) | 1370 | void lbs_stop_card(struct lbs_private *priv) |
1371 | { | 1371 | { |
1372 | struct net_device *dev = priv->dev; | 1372 | struct net_device *dev; |
1373 | struct cmd_ctrl_node *cmdnode; | 1373 | struct cmd_ctrl_node *cmdnode; |
1374 | unsigned long flags; | 1374 | unsigned long flags; |
1375 | 1375 | ||
@@ -1377,9 +1377,10 @@ void lbs_stop_card(struct lbs_private *priv) | |||
1377 | 1377 | ||
1378 | if (!priv) | 1378 | if (!priv) |
1379 | goto out; | 1379 | goto out; |
1380 | dev = priv->dev; | ||
1380 | 1381 | ||
1381 | netif_stop_queue(priv->dev); | 1382 | netif_stop_queue(dev); |
1382 | netif_carrier_off(priv->dev); | 1383 | netif_carrier_off(dev); |
1383 | 1384 | ||
1384 | lbs_debugfs_remove_one(priv); | 1385 | lbs_debugfs_remove_one(priv); |
1385 | if (priv->mesh_tlv) { | 1386 | if (priv->mesh_tlv) { |