diff options
author | Holger Schurig <hs4233@mail.mn-solutions.de> | 2007-08-02 11:50:12 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:49:50 -0400 |
commit | 3cf840914bd467fa4cc76af1a01bba4d2813131c (patch) | |
tree | ce3adcd8be98a4e1cf5c0968ec8742fbd8fac029 /drivers/net/wireless/libertas/main.c | |
parent | c95c7f930ec6fee029c8e7957ab95b3967578070 (diff) |
[PATCH] libertas: access mesh_dev more carefully
The CF/SDIO firmware doesn't support Mesh, so priv->mesh_dev is
NULL there. Protect all accesses.
Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/main.c')
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 170dc2394d25..b4e2cd19c3bc 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -298,10 +298,12 @@ static int libertas_dev_open(struct net_device *dev) | |||
298 | 298 | ||
299 | if (adapter->connect_status == LIBERTAS_CONNECTED) { | 299 | if (adapter->connect_status == LIBERTAS_CONNECTED) { |
300 | netif_carrier_on(priv->dev); | 300 | netif_carrier_on(priv->dev); |
301 | netif_carrier_on(priv->mesh_dev); | 301 | if (priv->mesh_dev) |
302 | netif_carrier_on(priv->mesh_dev); | ||
302 | } else { | 303 | } else { |
303 | netif_carrier_off(priv->dev); | 304 | netif_carrier_off(priv->dev); |
304 | netif_carrier_off(priv->mesh_dev); | 305 | if (priv->mesh_dev) |
306 | netif_carrier_off(priv->mesh_dev); | ||
305 | } | 307 | } |
306 | 308 | ||
307 | lbs_deb_leave(LBS_DEB_NET); | 309 | lbs_deb_leave(LBS_DEB_NET); |
@@ -408,7 +410,8 @@ static int libertas_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
408 | } | 410 | } |
409 | 411 | ||
410 | netif_stop_queue(priv->dev); | 412 | netif_stop_queue(priv->dev); |
411 | netif_stop_queue(priv->mesh_dev); | 413 | if (priv->mesh_dev) |
414 | netif_stop_queue(priv->mesh_dev); | ||
412 | 415 | ||
413 | if (libertas_process_tx(priv, skb) == 0) | 416 | if (libertas_process_tx(priv, skb) == 0) |
414 | dev->trans_start = jiffies; | 417 | dev->trans_start = jiffies; |
@@ -474,7 +477,8 @@ static void libertas_tx_timeout(struct net_device *dev) | |||
474 | wake_up_interruptible(&priv->waitq); | 477 | wake_up_interruptible(&priv->waitq); |
475 | } else if (priv->adapter->connect_status == LIBERTAS_CONNECTED) { | 478 | } else if (priv->adapter->connect_status == LIBERTAS_CONNECTED) { |
476 | netif_wake_queue(priv->dev); | 479 | netif_wake_queue(priv->dev); |
477 | netif_wake_queue(priv->mesh_dev); | 480 | if (priv->mesh_dev) |
481 | netif_wake_queue(priv->mesh_dev); | ||
478 | } | 482 | } |
479 | 483 | ||
480 | lbs_deb_leave(LBS_DEB_TX); | 484 | lbs_deb_leave(LBS_DEB_TX); |
@@ -1254,7 +1258,6 @@ int libertas_add_mesh(wlan_private *priv, struct device *dev) | |||
1254 | ret = 0; | 1258 | ret = 0; |
1255 | goto done; | 1259 | goto done; |
1256 | 1260 | ||
1257 | |||
1258 | err_unregister: | 1261 | err_unregister: |
1259 | unregister_netdev(mesh_dev); | 1262 | unregister_netdev(mesh_dev); |
1260 | 1263 | ||
@@ -1454,7 +1457,8 @@ void libertas_interrupt(struct net_device *dev) | |||
1454 | if (priv->adapter->psstate == PS_STATE_SLEEP) { | 1457 | if (priv->adapter->psstate == PS_STATE_SLEEP) { |
1455 | priv->adapter->psstate = PS_STATE_AWAKE; | 1458 | priv->adapter->psstate = PS_STATE_AWAKE; |
1456 | netif_wake_queue(dev); | 1459 | netif_wake_queue(dev); |
1457 | netif_wake_queue(priv->mesh_dev); | 1460 | if (priv->mesh_dev) |
1461 | netif_wake_queue(priv->mesh_dev); | ||
1458 | } | 1462 | } |
1459 | 1463 | ||
1460 | wake_up_interruptible(&priv->waitq); | 1464 | wake_up_interruptible(&priv->waitq); |