[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>
This commit is contained in:
Holger Schurig
2007-08-02 11:50:12 -04:00
committed by David S. Miller
parent c95c7f930e
commit 3cf840914b
4 changed files with 34 additions and 18 deletions

View File

@@ -739,8 +739,10 @@ int libertas_ret_80211_associate(wlan_private * priv,
netif_carrier_on(priv->dev); netif_carrier_on(priv->dev);
netif_wake_queue(priv->dev); netif_wake_queue(priv->dev);
if (priv->mesh_dev) {
netif_carrier_on(priv->mesh_dev); netif_carrier_on(priv->mesh_dev);
netif_wake_queue(priv->mesh_dev); netif_wake_queue(priv->mesh_dev);
}
lbs_deb_join("ASSOC_RESP: Associated \n"); lbs_deb_join("ASSOC_RESP: Associated \n");
@@ -827,8 +829,10 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv,
netif_carrier_on(priv->dev); netif_carrier_on(priv->dev);
netif_wake_queue(priv->dev); netif_wake_queue(priv->dev);
if (priv->mesh_dev) {
netif_carrier_on(priv->mesh_dev); netif_carrier_on(priv->mesh_dev);
netif_wake_queue(priv->mesh_dev); netif_wake_queue(priv->mesh_dev);
}
memset(&wrqu, 0, sizeof(wrqu)); memset(&wrqu, 0, sizeof(wrqu));
memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN);

View File

@@ -298,9 +298,11 @@ static int libertas_dev_open(struct net_device *dev)
if (adapter->connect_status == LIBERTAS_CONNECTED) { if (adapter->connect_status == LIBERTAS_CONNECTED) {
netif_carrier_on(priv->dev); netif_carrier_on(priv->dev);
if (priv->mesh_dev)
netif_carrier_on(priv->mesh_dev); netif_carrier_on(priv->mesh_dev);
} else { } else {
netif_carrier_off(priv->dev); netif_carrier_off(priv->dev);
if (priv->mesh_dev)
netif_carrier_off(priv->mesh_dev); netif_carrier_off(priv->mesh_dev);
} }
@@ -408,6 +410,7 @@ static int libertas_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
} }
netif_stop_queue(priv->dev); netif_stop_queue(priv->dev);
if (priv->mesh_dev)
netif_stop_queue(priv->mesh_dev); netif_stop_queue(priv->mesh_dev);
if (libertas_process_tx(priv, skb) == 0) if (libertas_process_tx(priv, skb) == 0)
@@ -474,6 +477,7 @@ static void libertas_tx_timeout(struct net_device *dev)
wake_up_interruptible(&priv->waitq); wake_up_interruptible(&priv->waitq);
} else if (priv->adapter->connect_status == LIBERTAS_CONNECTED) { } else if (priv->adapter->connect_status == LIBERTAS_CONNECTED) {
netif_wake_queue(priv->dev); netif_wake_queue(priv->dev);
if (priv->mesh_dev)
netif_wake_queue(priv->mesh_dev); netif_wake_queue(priv->mesh_dev);
} }
@@ -1254,7 +1258,6 @@ int libertas_add_mesh(wlan_private *priv, struct device *dev)
ret = 0; ret = 0;
goto done; goto done;
err_unregister: err_unregister:
unregister_netdev(mesh_dev); unregister_netdev(mesh_dev);
@@ -1454,6 +1457,7 @@ void libertas_interrupt(struct net_device *dev)
if (priv->adapter->psstate == PS_STATE_SLEEP) { if (priv->adapter->psstate == PS_STATE_SLEEP) {
priv->adapter->psstate = PS_STATE_AWAKE; priv->adapter->psstate = PS_STATE_AWAKE;
netif_wake_queue(dev); netif_wake_queue(dev);
if (priv->mesh_dev)
netif_wake_queue(priv->mesh_dev); netif_wake_queue(priv->mesh_dev);
} }

View File

@@ -793,9 +793,11 @@ int wlan_scan_networks(wlan_private * priv,
if (!scancurrentchanonly) { if (!scancurrentchanonly) {
netif_stop_queue(priv->dev); netif_stop_queue(priv->dev);
netif_carrier_off(priv->dev); netif_carrier_off(priv->dev);
if (priv->mesh_dev) {
netif_stop_queue(priv->mesh_dev); netif_stop_queue(priv->mesh_dev);
netif_carrier_off(priv->mesh_dev); netif_carrier_off(priv->mesh_dev);
} }
}
ret = wlan_scan_channel_list(priv, ret = wlan_scan_channel_list(priv,
maxchanperscan, maxchanperscan,
@@ -820,9 +822,11 @@ int wlan_scan_networks(wlan_private * priv,
if (priv->adapter->connect_status == LIBERTAS_CONNECTED) { if (priv->adapter->connect_status == LIBERTAS_CONNECTED) {
netif_carrier_on(priv->dev); netif_carrier_on(priv->dev);
netif_wake_queue(priv->dev); netif_wake_queue(priv->dev);
if (priv->mesh_dev) {
netif_carrier_on(priv->mesh_dev); netif_carrier_on(priv->mesh_dev);
netif_wake_queue(priv->mesh_dev); netif_wake_queue(priv->mesh_dev);
} }
}
out: out:
if (scan_cfg) if (scan_cfg)

View File

@@ -159,6 +159,7 @@ done:
skb_orphan(skb); skb_orphan(skb);
/* stop processing outgoing pkts */ /* stop processing outgoing pkts */
netif_stop_queue(priv->dev); netif_stop_queue(priv->dev);
if (priv->mesh_dev)
netif_stop_queue(priv->mesh_dev); netif_stop_queue(priv->mesh_dev);
/* freeze any packets already in our queues */ /* freeze any packets already in our queues */
priv->adapter->TxLockFlag = 1; priv->adapter->TxLockFlag = 1;
@@ -198,9 +199,11 @@ static void wlan_tx_queue(wlan_private *priv, struct sk_buff *skb)
adapter->tx_queue_ps[adapter->tx_queue_idx++] = skb; adapter->tx_queue_ps[adapter->tx_queue_idx++] = skb;
if (adapter->tx_queue_idx == NR_TX_QUEUE) { if (adapter->tx_queue_idx == NR_TX_QUEUE) {
netif_stop_queue(priv->dev); netif_stop_queue(priv->dev);
if (priv->mesh_dev)
netif_stop_queue(priv->mesh_dev); netif_stop_queue(priv->mesh_dev);
} else { } else {
netif_start_queue(priv->dev); netif_start_queue(priv->dev);
if (priv->mesh_dev)
netif_start_queue(priv->mesh_dev); netif_start_queue(priv->mesh_dev);
} }
@@ -285,6 +288,7 @@ void libertas_send_tx_feedback(wlan_private * priv)
priv->adapter->TxLockFlag = 0; priv->adapter->TxLockFlag = 0;
if (priv->adapter->connect_status == LIBERTAS_CONNECTED) { if (priv->adapter->connect_status == LIBERTAS_CONNECTED) {
netif_wake_queue(priv->dev); netif_wake_queue(priv->dev);
if (priv->mesh_dev)
netif_wake_queue(priv->mesh_dev); netif_wake_queue(priv->mesh_dev);
} }
} }