Skip to content

Commit

Permalink
ipw2200: fix oops on missing firmware
Browse files Browse the repository at this point in the history
For non-monitor interfaces, the syntax for alloc_ieee80211/free_80211
is wrong. Because alloc_ieee80211 only creates (wiphy_new) a wiphy, but
free_80211() does wiphy_unregister() also. This is only correct when
the later wiphy_register() is called successfully, which apparently
is not the case for your fw doesn't exist one.

Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Zhu Yi authored and John W. Linville committed Oct 30, 2009
1 parent 63ca2d7 commit e6c5fc5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
5 changes: 4 additions & 1 deletion drivers/net/wireless/ipw2x00/ipw2100.c
Original file line number Diff line number Diff line change
Expand Up @@ -6325,8 +6325,10 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,

fail:
if (dev) {
if (registered)
if (registered) {
unregister_ieee80211(priv->ieee);
unregister_netdev(dev);
}

ipw2100_hw_stop_adapter(priv);

Expand Down Expand Up @@ -6383,6 +6385,7 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev)
/* Unregister the device first - this results in close()
* being called if the device is open. If we free storage
* first, then close() will crash. */
unregister_ieee80211(priv->ieee);
unregister_netdev(dev);

/* ipw2100_down will ensure that there is no more pending work
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/wireless/ipw2x00/ipw2200.c
Original file line number Diff line number Diff line change
Expand Up @@ -11821,6 +11821,7 @@ static int __devinit ipw_pci_probe(struct pci_dev *pdev,
if (err) {
IPW_ERROR("Failed to register promiscuous network "
"device (error %d).\n", err);
unregister_ieee80211(priv->ieee);
unregister_netdev(priv->net_dev);
goto out_remove_sysfs;
}
Expand Down Expand Up @@ -11871,6 +11872,7 @@ static void __devexit ipw_pci_remove(struct pci_dev *pdev)

mutex_unlock(&priv->mutex);

unregister_ieee80211(priv->ieee);
unregister_netdev(priv->net_dev);

if (priv->rxq) {
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/ipw2x00/libipw.h
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,7 @@ static inline int libipw_is_cck_rate(u8 rate)
/* ieee80211.c */
extern void free_ieee80211(struct net_device *dev, int monitor);
extern struct net_device *alloc_ieee80211(int sizeof_priv, int monitor);
extern void unregister_ieee80211(struct libipw_device *ieee);
extern int libipw_change_mtu(struct net_device *dev, int new_mtu);

extern void libipw_networks_age(struct libipw_device *ieee,
Expand Down
14 changes: 9 additions & 5 deletions drivers/net/wireless/ipw2x00/libipw_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,19 @@ void free_ieee80211(struct net_device *dev, int monitor)
libipw_networks_free(ieee);

/* free cfg80211 resources */
if (!monitor) {
wiphy_unregister(ieee->wdev.wiphy);
kfree(ieee->a_band.channels);
kfree(ieee->bg_band.channels);
if (!monitor)
wiphy_free(ieee->wdev.wiphy);
}

free_netdev(dev);
}

void unregister_ieee80211(struct libipw_device *ieee)
{
wiphy_unregister(ieee->wdev.wiphy);
kfree(ieee->a_band.channels);
kfree(ieee->bg_band.channels);
}

#ifdef CONFIG_LIBIPW_DEBUG

static int debug = 0;
Expand Down Expand Up @@ -330,3 +333,4 @@ module_init(libipw_init);

EXPORT_SYMBOL(alloc_ieee80211);
EXPORT_SYMBOL(free_ieee80211);
EXPORT_SYMBOL(unregister_ieee80211);

0 comments on commit e6c5fc5

Please sign in to comment.