提交 a9b9361d 编写于 作者: C Christian Lamparter 提交者: 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: NChristian Lamparter <chunkeey@googlemail.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 52a3f20c
......@@ -796,11 +796,14 @@ int p54_register_common(struct ieee80211_hw *dev, struct device *pdev)
dev_err(pdev, "Cannot register device (%d).\n", err);
return err;
}
priv->registered = true;
#ifdef CONFIG_P54_LEDS
err = p54_init_leds(priv);
if (err)
if (err) {
p54_unregister_common(dev);
return err;
}
#endif /* CONFIG_P54_LEDS */
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);
#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->eeprom_mutex);
}
......
......@@ -173,6 +173,7 @@ struct p54_common {
struct sk_buff_head tx_pending;
struct sk_buff_head tx_queue;
struct mutex conf_mutex;
bool registered;
/* memory management (as seen by the firmware) */
u32 rx_start;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册