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: Christian Lamparter <chunkeey@googlemail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
committed by
John W. Linville
parent
52a3f20c09
commit
a9b9361dd5
@@ -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)
|
|||||||
p54_unregister_leds(priv);
|
p54_unregister_leds(priv);
|
||||||
#endif /* CONFIG_P54_LEDS */
|
#endif /* CONFIG_P54_LEDS */
|
||||||
|
|
||||||
ieee80211_unregister_hw(dev);
|
if (priv->registered) {
|
||||||
|
priv->registered = false;
|
||||||
|
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 {
|
|||||||
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;
|
||||||
|
Reference in New Issue
Block a user