aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ipw2x00
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2010-04-08 13:34:54 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-04-08 13:34:54 -0400
commit0f2df9eac70423838a1f8d410fd3899ddd88317b (patch)
tree0617f723320d83eca5cef9c964c001014e74213f /drivers/net/wireless/ipw2x00
parent8c11e4ab09ffb975a89802dde0e9aa52a53b8aa5 (diff)
parent1144601118507f8b3b676a9a392584d216d3f2cc (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6 into merge
Conflicts: Documentation/feature-removal-schedule.txt drivers/net/wireless/ath/ath5k/phy.c drivers/net/wireless/iwlwifi/iwl-4965.c drivers/net/wireless/iwlwifi/iwl-agn.c drivers/net/wireless/iwlwifi/iwl-core.c drivers/net/wireless/iwlwifi/iwl-core.h drivers/net/wireless/iwlwifi/iwl-tx.c
Diffstat (limited to 'drivers/net/wireless/ipw2x00')
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2200.c19
-rw-r--r--drivers/net/wireless/ipw2x00/libipw.h2
-rw-r--r--drivers/net/wireless/ipw2x00/libipw_module.c37
3 files changed, 35 insertions, 23 deletions
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 192abfdc5039..9e2ae8f3ecb0 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -3186,14 +3186,27 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len)
3186 int total_nr = 0; 3186 int total_nr = 0;
3187 int i; 3187 int i;
3188 struct pci_pool *pool; 3188 struct pci_pool *pool;
3189 u32 *virts[CB_NUMBER_OF_ELEMENTS_SMALL]; 3189 void **virts;
3190 dma_addr_t phys[CB_NUMBER_OF_ELEMENTS_SMALL]; 3190 dma_addr_t *phys;
3191 3191
3192 IPW_DEBUG_TRACE("<< :\n"); 3192 IPW_DEBUG_TRACE("<< :\n");
3193 3193
3194 virts = kmalloc(sizeof(void *) * CB_NUMBER_OF_ELEMENTS_SMALL,
3195 GFP_KERNEL);
3196 if (!virts)
3197 return -ENOMEM;
3198
3199 phys = kmalloc(sizeof(dma_addr_t) * CB_NUMBER_OF_ELEMENTS_SMALL,
3200 GFP_KERNEL);
3201 if (!phys) {
3202 kfree(virts);
3203 return -ENOMEM;
3204 }
3194 pool = pci_pool_create("ipw2200", priv->pci_dev, CB_MAX_LENGTH, 0, 0); 3205 pool = pci_pool_create("ipw2200", priv->pci_dev, CB_MAX_LENGTH, 0, 0);
3195 if (!pool) { 3206 if (!pool) {
3196 IPW_ERROR("pci_pool_create failed\n"); 3207 IPW_ERROR("pci_pool_create failed\n");
3208 kfree(phys);
3209 kfree(virts);
3197 return -ENOMEM; 3210 return -ENOMEM;
3198 } 3211 }
3199 3212
@@ -3263,6 +3276,8 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len)
3263 pci_pool_free(pool, virts[i], phys[i]); 3276 pci_pool_free(pool, virts[i], phys[i]);
3264 3277
3265 pci_pool_destroy(pool); 3278 pci_pool_destroy(pool);
3279 kfree(phys);
3280 kfree(virts);
3266 3281
3267 return ret; 3282 return ret;
3268} 3283}
diff --git a/drivers/net/wireless/ipw2x00/libipw.h b/drivers/net/wireless/ipw2x00/libipw.h
index 9ac136b98bb3..284b0e4cb815 100644
--- a/drivers/net/wireless/ipw2x00/libipw.h
+++ b/drivers/net/wireless/ipw2x00/libipw.h
@@ -797,7 +797,7 @@ struct libipw_device {
797 /* Probe / Beacon management */ 797 /* Probe / Beacon management */
798 struct list_head network_free_list; 798 struct list_head network_free_list;
799 struct list_head network_list; 799 struct list_head network_list;
800 struct libipw_network *networks; 800 struct libipw_network *networks[MAX_NETWORK_COUNT];
801 int scans; 801 int scans;
802 int scan_age; 802 int scan_age;
803 803
diff --git a/drivers/net/wireless/ipw2x00/libipw_module.c b/drivers/net/wireless/ipw2x00/libipw_module.c
index 5b8841159b7c..55965408ff3f 100644
--- a/drivers/net/wireless/ipw2x00/libipw_module.c
+++ b/drivers/net/wireless/ipw2x00/libipw_module.c
@@ -67,16 +67,17 @@ void *libipw_wiphy_privid = &libipw_wiphy_privid;
67 67
68static int libipw_networks_allocate(struct libipw_device *ieee) 68static int libipw_networks_allocate(struct libipw_device *ieee)
69{ 69{
70 if (ieee->networks) 70 int i, j;
71 return 0; 71
72 72 for (i = 0; i < MAX_NETWORK_COUNT; i++) {
73 ieee->networks = 73 ieee->networks[i] = kzalloc(sizeof(struct libipw_network),
74 kzalloc(MAX_NETWORK_COUNT * sizeof(struct libipw_network), 74 GFP_KERNEL);
75 GFP_KERNEL); 75 if (!ieee->networks[i]) {
76 if (!ieee->networks) { 76 LIBIPW_ERROR("Out of memory allocating beacons\n");
77 printk(KERN_WARNING "%s: Out of memory allocating beacons\n", 77 for (j = 0; j < i; j++)
78 ieee->dev->name); 78 kfree(ieee->networks[j]);
79 return -ENOMEM; 79 return -ENOMEM;
80 }
80 } 81 }
81 82
82 return 0; 83 return 0;
@@ -97,15 +98,11 @@ static inline void libipw_networks_free(struct libipw_device *ieee)
97{ 98{
98 int i; 99 int i;
99 100
100 if (!ieee->networks) 101 for (i = 0; i < MAX_NETWORK_COUNT; i++) {
101 return; 102 if (ieee->networks[i]->ibss_dfs)
102 103 kfree(ieee->networks[i]->ibss_dfs);
103 for (i = 0; i < MAX_NETWORK_COUNT; i++) 104 kfree(ieee->networks[i]);
104 if (ieee->networks[i].ibss_dfs) 105 }
105 kfree(ieee->networks[i].ibss_dfs);
106
107 kfree(ieee->networks);
108 ieee->networks = NULL;
109} 106}
110 107
111void libipw_networks_age(struct libipw_device *ieee, 108void libipw_networks_age(struct libipw_device *ieee,
@@ -130,7 +127,7 @@ static void libipw_networks_initialize(struct libipw_device *ieee)
130 INIT_LIST_HEAD(&ieee->network_free_list); 127 INIT_LIST_HEAD(&ieee->network_free_list);
131 INIT_LIST_HEAD(&ieee->network_list); 128 INIT_LIST_HEAD(&ieee->network_list);
132 for (i = 0; i < MAX_NETWORK_COUNT; i++) 129 for (i = 0; i < MAX_NETWORK_COUNT; i++)
133 list_add_tail(&ieee->networks[i].list, 130 list_add_tail(&ieee->networks[i]->list,
134 &ieee->network_free_list); 131 &ieee->network_free_list);
135} 132}
136 133