Commit a9b9361d authored by Christian Lamparter's avatar Christian Lamparter Committed by John W. Linville

p54: only unregister ieee80211_hw when it has been registered

p54_unregister_common may now be called by the backend
driver's remove routine, even if the ieee80211_hw device
struct was never successfully registered.
Signed-off-by: default avatarChristian Lamparter <chunkeey@googlemail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 52a3f20c
...@@ -796,11 +796,14 @@ int p54_register_common(struct ieee80211_hw *dev, struct device *pdev) ...@@ -796,11 +796,14 @@ int p54_register_common(struct ieee80211_hw *dev, struct device *pdev)
dev_err(pdev, "Cannot register device (%d).\n", err); dev_err(pdev, "Cannot register device (%d).\n", err);
return err; return err;
} }
priv->registered = true;
#ifdef CONFIG_P54_LEDS #ifdef CONFIG_P54_LEDS
err = p54_init_leds(priv); err = p54_init_leds(priv);
if (err) if (err) {
p54_unregister_common(dev);
return err; return err;
}
#endif /* CONFIG_P54_LEDS */ #endif /* CONFIG_P54_LEDS */
dev_info(pdev, "is registered as '%s'\n", wiphy_name(dev->wiphy)); dev_info(pdev, "is registered as '%s'\n", wiphy_name(dev->wiphy));
...@@ -840,7 +843,11 @@ void p54_unregister_common(struct ieee80211_hw *dev) ...@@ -840,7 +843,11 @@ void p54_unregister_common(struct ieee80211_hw *dev)
p54_unregister_leds(priv); p54_unregister_leds(priv);
#endif /* CONFIG_P54_LEDS */ #endif /* CONFIG_P54_LEDS */
if (priv->registered) {
priv->registered = false;
ieee80211_unregister_hw(dev); ieee80211_unregister_hw(dev);
}
mutex_destroy(&priv->conf_mutex); mutex_destroy(&priv->conf_mutex);
mutex_destroy(&priv->eeprom_mutex); mutex_destroy(&priv->eeprom_mutex);
} }
......
...@@ -173,6 +173,7 @@ struct p54_common { ...@@ -173,6 +173,7 @@ struct p54_common {
struct sk_buff_head tx_pending; struct sk_buff_head tx_pending;
struct sk_buff_head tx_queue; struct sk_buff_head tx_queue;
struct mutex conf_mutex; struct mutex conf_mutex;
bool registered;
/* memory management (as seen by the firmware) */ /* memory management (as seen by the firmware) */
u32 rx_start; u32 rx_start;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment