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 | |
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>
-rw-r--r-- | drivers/net/wireless/libertas/join.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 16 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/scan.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/tx.c | 12 |
4 files changed, 34 insertions, 18 deletions
diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c index f9799c3b81c2..da47c225e101 100644 --- a/drivers/net/wireless/libertas/join.c +++ b/drivers/net/wireless/libertas/join.c | |||
@@ -739,8 +739,10 @@ int libertas_ret_80211_associate(wlan_private * priv, | |||
739 | netif_carrier_on(priv->dev); | 739 | netif_carrier_on(priv->dev); |
740 | netif_wake_queue(priv->dev); | 740 | netif_wake_queue(priv->dev); |
741 | 741 | ||
742 | netif_carrier_on(priv->mesh_dev); | 742 | if (priv->mesh_dev) { |
743 | netif_wake_queue(priv->mesh_dev); | 743 | netif_carrier_on(priv->mesh_dev); |
744 | netif_wake_queue(priv->mesh_dev); | ||
745 | } | ||
744 | 746 | ||
745 | lbs_deb_join("ASSOC_RESP: Associated \n"); | 747 | lbs_deb_join("ASSOC_RESP: Associated \n"); |
746 | 748 | ||
@@ -827,8 +829,10 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv, | |||
827 | netif_carrier_on(priv->dev); | 829 | netif_carrier_on(priv->dev); |
828 | netif_wake_queue(priv->dev); | 830 | netif_wake_queue(priv->dev); |
829 | 831 | ||
830 | netif_carrier_on(priv->mesh_dev); | 832 | if (priv->mesh_dev) { |
831 | netif_wake_queue(priv->mesh_dev); | 833 | netif_carrier_on(priv->mesh_dev); |
834 | netif_wake_queue(priv->mesh_dev); | ||
835 | } | ||
832 | 836 | ||
833 | memset(&wrqu, 0, sizeof(wrqu)); | 837 | memset(&wrqu, 0, sizeof(wrqu)); |
834 | memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); | 838 | memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); |
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); |
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index 683fa1ba5cac..7f045ec2441d 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c | |||
@@ -793,8 +793,10 @@ int wlan_scan_networks(wlan_private * priv, | |||
793 | if (!scancurrentchanonly) { | 793 | if (!scancurrentchanonly) { |
794 | netif_stop_queue(priv->dev); | 794 | netif_stop_queue(priv->dev); |
795 | netif_carrier_off(priv->dev); | 795 | netif_carrier_off(priv->dev); |
796 | netif_stop_queue(priv->mesh_dev); | 796 | if (priv->mesh_dev) { |
797 | netif_carrier_off(priv->mesh_dev); | 797 | netif_stop_queue(priv->mesh_dev); |
798 | netif_carrier_off(priv->mesh_dev); | ||
799 | } | ||
798 | } | 800 | } |
799 | 801 | ||
800 | ret = wlan_scan_channel_list(priv, | 802 | ret = wlan_scan_channel_list(priv, |
@@ -820,8 +822,10 @@ int wlan_scan_networks(wlan_private * priv, | |||
820 | if (priv->adapter->connect_status == LIBERTAS_CONNECTED) { | 822 | if (priv->adapter->connect_status == LIBERTAS_CONNECTED) { |
821 | netif_carrier_on(priv->dev); | 823 | netif_carrier_on(priv->dev); |
822 | netif_wake_queue(priv->dev); | 824 | netif_wake_queue(priv->dev); |
823 | netif_carrier_on(priv->mesh_dev); | 825 | if (priv->mesh_dev) { |
824 | netif_wake_queue(priv->mesh_dev); | 826 | netif_carrier_on(priv->mesh_dev); |
827 | netif_wake_queue(priv->mesh_dev); | ||
828 | } | ||
825 | } | 829 | } |
826 | 830 | ||
827 | out: | 831 | out: |
diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index c2271020aafe..7c383014a274 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c | |||
@@ -159,7 +159,8 @@ done: | |||
159 | skb_orphan(skb); | 159 | skb_orphan(skb); |
160 | /* stop processing outgoing pkts */ | 160 | /* stop processing outgoing pkts */ |
161 | netif_stop_queue(priv->dev); | 161 | netif_stop_queue(priv->dev); |
162 | netif_stop_queue(priv->mesh_dev); | 162 | if (priv->mesh_dev) |
163 | netif_stop_queue(priv->mesh_dev); | ||
163 | /* freeze any packets already in our queues */ | 164 | /* freeze any packets already in our queues */ |
164 | priv->adapter->TxLockFlag = 1; | 165 | priv->adapter->TxLockFlag = 1; |
165 | } else { | 166 | } else { |
@@ -198,10 +199,12 @@ static void wlan_tx_queue(wlan_private *priv, struct sk_buff *skb) | |||
198 | adapter->tx_queue_ps[adapter->tx_queue_idx++] = skb; | 199 | adapter->tx_queue_ps[adapter->tx_queue_idx++] = skb; |
199 | if (adapter->tx_queue_idx == NR_TX_QUEUE) { | 200 | if (adapter->tx_queue_idx == NR_TX_QUEUE) { |
200 | netif_stop_queue(priv->dev); | 201 | netif_stop_queue(priv->dev); |
201 | netif_stop_queue(priv->mesh_dev); | 202 | if (priv->mesh_dev) |
203 | netif_stop_queue(priv->mesh_dev); | ||
202 | } else { | 204 | } else { |
203 | netif_start_queue(priv->dev); | 205 | netif_start_queue(priv->dev); |
204 | netif_start_queue(priv->mesh_dev); | 206 | if (priv->mesh_dev) |
207 | netif_start_queue(priv->mesh_dev); | ||
205 | } | 208 | } |
206 | 209 | ||
207 | spin_unlock(&adapter->txqueue_lock); | 210 | spin_unlock(&adapter->txqueue_lock); |
@@ -285,7 +288,8 @@ void libertas_send_tx_feedback(wlan_private * priv) | |||
285 | priv->adapter->TxLockFlag = 0; | 288 | priv->adapter->TxLockFlag = 0; |
286 | if (priv->adapter->connect_status == LIBERTAS_CONNECTED) { | 289 | if (priv->adapter->connect_status == LIBERTAS_CONNECTED) { |
287 | netif_wake_queue(priv->dev); | 290 | netif_wake_queue(priv->dev); |
288 | netif_wake_queue(priv->mesh_dev); | 291 | if (priv->mesh_dev) |
292 | netif_wake_queue(priv->mesh_dev); | ||
289 | } | 293 | } |
290 | } | 294 | } |
291 | EXPORT_SYMBOL_GPL(libertas_send_tx_feedback); | 295 | EXPORT_SYMBOL_GPL(libertas_send_tx_feedback); |