diff options
author | Panagiotis Issaris <takis@issaris.org> | 2005-11-07 18:03:15 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2005-11-07 21:50:01 -0500 |
commit | b69a3aa85cb7bda2eb6c5932a62c1337d0d6612c (patch) | |
tree | 64a65fcec724795c213ab96c1419c95a78c41be4 | |
parent | f36be62115aabd50b4eda0f06f07ab5fae2e9cfd (diff) |
[PATCH] wireless net: Conversions of kmalloc/memset to kzalloc
More conversions of kmalloc/memset to kzalloc
Signed-off-by: Panagiotis Issaris <takis@issaris.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/airo.c | 36 | ||||
-rw-r--r-- | drivers/net/wireless/airo_cs.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/atmel_cs.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/ipw2100.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/wavelan_cs.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/wl3501_cs.c | 3 |
6 files changed, 19 insertions, 39 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 849ac88bcccc..58ca585caa59 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -4533,9 +4533,8 @@ static int proc_status_open( struct inode *inode, struct file *file ) { | |||
4533 | StatusRid status_rid; | 4533 | StatusRid status_rid; |
4534 | int i; | 4534 | int i; |
4535 | 4535 | ||
4536 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 4536 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
4537 | return -ENOMEM; | 4537 | return -ENOMEM; |
4538 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
4539 | data = (struct proc_data *)file->private_data; | 4538 | data = (struct proc_data *)file->private_data; |
4540 | if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { | 4539 | if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { |
4541 | kfree (file->private_data); | 4540 | kfree (file->private_data); |
@@ -4613,9 +4612,8 @@ static int proc_stats_rid_open( struct inode *inode, | |||
4613 | int i, j; | 4612 | int i, j; |
4614 | u32 *vals = stats.vals; | 4613 | u32 *vals = stats.vals; |
4615 | 4614 | ||
4616 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 4615 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
4617 | return -ENOMEM; | 4616 | return -ENOMEM; |
4618 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
4619 | data = (struct proc_data *)file->private_data; | 4617 | data = (struct proc_data *)file->private_data; |
4620 | if ((data->rbuffer = kmalloc( 4096, GFP_KERNEL )) == NULL) { | 4618 | if ((data->rbuffer = kmalloc( 4096, GFP_KERNEL )) == NULL) { |
4621 | kfree (file->private_data); | 4619 | kfree (file->private_data); |
@@ -4879,20 +4877,18 @@ static int proc_config_open( struct inode *inode, struct file *file ) { | |||
4879 | struct airo_info *ai = dev->priv; | 4877 | struct airo_info *ai = dev->priv; |
4880 | int i; | 4878 | int i; |
4881 | 4879 | ||
4882 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 4880 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
4883 | return -ENOMEM; | 4881 | return -ENOMEM; |
4884 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
4885 | data = (struct proc_data *)file->private_data; | 4882 | data = (struct proc_data *)file->private_data; |
4886 | if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { | 4883 | if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { |
4887 | kfree (file->private_data); | 4884 | kfree (file->private_data); |
4888 | return -ENOMEM; | 4885 | return -ENOMEM; |
4889 | } | 4886 | } |
4890 | if ((data->wbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { | 4887 | if ((data->wbuffer = kzalloc( 2048, GFP_KERNEL )) == NULL) { |
4891 | kfree (data->rbuffer); | 4888 | kfree (data->rbuffer); |
4892 | kfree (file->private_data); | 4889 | kfree (file->private_data); |
4893 | return -ENOMEM; | 4890 | return -ENOMEM; |
4894 | } | 4891 | } |
4895 | memset( data->wbuffer, 0, 2048 ); | ||
4896 | data->maxwritelen = 2048; | 4892 | data->maxwritelen = 2048; |
4897 | data->on_close = proc_config_on_close; | 4893 | data->on_close = proc_config_on_close; |
4898 | 4894 | ||
@@ -5153,24 +5149,21 @@ static int proc_wepkey_open( struct inode *inode, struct file *file ) { | |||
5153 | int j=0; | 5149 | int j=0; |
5154 | int rc; | 5150 | int rc; |
5155 | 5151 | ||
5156 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 5152 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
5157 | return -ENOMEM; | 5153 | return -ENOMEM; |
5158 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
5159 | memset(&wkr, 0, sizeof(wkr)); | 5154 | memset(&wkr, 0, sizeof(wkr)); |
5160 | data = (struct proc_data *)file->private_data; | 5155 | data = (struct proc_data *)file->private_data; |
5161 | if ((data->rbuffer = kmalloc( 180, GFP_KERNEL )) == NULL) { | 5156 | if ((data->rbuffer = kzalloc( 180, GFP_KERNEL )) == NULL) { |
5162 | kfree (file->private_data); | 5157 | kfree (file->private_data); |
5163 | return -ENOMEM; | 5158 | return -ENOMEM; |
5164 | } | 5159 | } |
5165 | memset(data->rbuffer, 0, 180); | ||
5166 | data->writelen = 0; | 5160 | data->writelen = 0; |
5167 | data->maxwritelen = 80; | 5161 | data->maxwritelen = 80; |
5168 | if ((data->wbuffer = kmalloc( 80, GFP_KERNEL )) == NULL) { | 5162 | if ((data->wbuffer = kzalloc( 80, GFP_KERNEL )) == NULL) { |
5169 | kfree (data->rbuffer); | 5163 | kfree (data->rbuffer); |
5170 | kfree (file->private_data); | 5164 | kfree (file->private_data); |
5171 | return -ENOMEM; | 5165 | return -ENOMEM; |
5172 | } | 5166 | } |
5173 | memset( data->wbuffer, 0, 80 ); | ||
5174 | data->on_close = proc_wepkey_on_close; | 5167 | data->on_close = proc_wepkey_on_close; |
5175 | 5168 | ||
5176 | ptr = data->rbuffer; | 5169 | ptr = data->rbuffer; |
@@ -5201,9 +5194,8 @@ static int proc_SSID_open( struct inode *inode, struct file *file ) { | |||
5201 | char *ptr; | 5194 | char *ptr; |
5202 | SsidRid SSID_rid; | 5195 | SsidRid SSID_rid; |
5203 | 5196 | ||
5204 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 5197 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
5205 | return -ENOMEM; | 5198 | return -ENOMEM; |
5206 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
5207 | data = (struct proc_data *)file->private_data; | 5199 | data = (struct proc_data *)file->private_data; |
5208 | if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) { | 5200 | if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) { |
5209 | kfree (file->private_data); | 5201 | kfree (file->private_data); |
@@ -5211,12 +5203,11 @@ static int proc_SSID_open( struct inode *inode, struct file *file ) { | |||
5211 | } | 5203 | } |
5212 | data->writelen = 0; | 5204 | data->writelen = 0; |
5213 | data->maxwritelen = 33*3; | 5205 | data->maxwritelen = 33*3; |
5214 | if ((data->wbuffer = kmalloc( 33*3, GFP_KERNEL )) == NULL) { | 5206 | if ((data->wbuffer = kzalloc( 33*3, GFP_KERNEL )) == NULL) { |
5215 | kfree (data->rbuffer); | 5207 | kfree (data->rbuffer); |
5216 | kfree (file->private_data); | 5208 | kfree (file->private_data); |
5217 | return -ENOMEM; | 5209 | return -ENOMEM; |
5218 | } | 5210 | } |
5219 | memset( data->wbuffer, 0, 33*3 ); | ||
5220 | data->on_close = proc_SSID_on_close; | 5211 | data->on_close = proc_SSID_on_close; |
5221 | 5212 | ||
5222 | readSsidRid(ai, &SSID_rid); | 5213 | readSsidRid(ai, &SSID_rid); |
@@ -5245,9 +5236,8 @@ static int proc_APList_open( struct inode *inode, struct file *file ) { | |||
5245 | char *ptr; | 5236 | char *ptr; |
5246 | APListRid APList_rid; | 5237 | APListRid APList_rid; |
5247 | 5238 | ||
5248 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 5239 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
5249 | return -ENOMEM; | 5240 | return -ENOMEM; |
5250 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
5251 | data = (struct proc_data *)file->private_data; | 5241 | data = (struct proc_data *)file->private_data; |
5252 | if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) { | 5242 | if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) { |
5253 | kfree (file->private_data); | 5243 | kfree (file->private_data); |
@@ -5255,12 +5245,11 @@ static int proc_APList_open( struct inode *inode, struct file *file ) { | |||
5255 | } | 5245 | } |
5256 | data->writelen = 0; | 5246 | data->writelen = 0; |
5257 | data->maxwritelen = 4*6*3; | 5247 | data->maxwritelen = 4*6*3; |
5258 | if ((data->wbuffer = kmalloc( data->maxwritelen, GFP_KERNEL )) == NULL) { | 5248 | if ((data->wbuffer = kzalloc( data->maxwritelen, GFP_KERNEL )) == NULL) { |
5259 | kfree (data->rbuffer); | 5249 | kfree (data->rbuffer); |
5260 | kfree (file->private_data); | 5250 | kfree (file->private_data); |
5261 | return -ENOMEM; | 5251 | return -ENOMEM; |
5262 | } | 5252 | } |
5263 | memset( data->wbuffer, 0, data->maxwritelen ); | ||
5264 | data->on_close = proc_APList_on_close; | 5253 | data->on_close = proc_APList_on_close; |
5265 | 5254 | ||
5266 | readAPListRid(ai, &APList_rid); | 5255 | readAPListRid(ai, &APList_rid); |
@@ -5295,9 +5284,8 @@ static int proc_BSSList_open( struct inode *inode, struct file *file ) { | |||
5295 | /* If doLoseSync is not 1, we won't do a Lose Sync */ | 5284 | /* If doLoseSync is not 1, we won't do a Lose Sync */ |
5296 | int doLoseSync = -1; | 5285 | int doLoseSync = -1; |
5297 | 5286 | ||
5298 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 5287 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
5299 | return -ENOMEM; | 5288 | return -ENOMEM; |
5300 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
5301 | data = (struct proc_data *)file->private_data; | 5289 | data = (struct proc_data *)file->private_data; |
5302 | if ((data->rbuffer = kmalloc( 1024, GFP_KERNEL )) == NULL) { | 5290 | if ((data->rbuffer = kmalloc( 1024, GFP_KERNEL )) == NULL) { |
5303 | kfree (file->private_data); | 5291 | kfree (file->private_data); |
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 784de9109113..fee458fd7a4a 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c | |||
@@ -172,12 +172,11 @@ static dev_link_t *airo_attach(void) | |||
172 | DEBUG(0, "airo_attach()\n"); | 172 | DEBUG(0, "airo_attach()\n"); |
173 | 173 | ||
174 | /* Initialize the dev_link_t structure */ | 174 | /* Initialize the dev_link_t structure */ |
175 | link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); | 175 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); |
176 | if (!link) { | 176 | if (!link) { |
177 | printk(KERN_ERR "airo_cs: no memory for new device\n"); | 177 | printk(KERN_ERR "airo_cs: no memory for new device\n"); |
178 | return NULL; | 178 | return NULL; |
179 | } | 179 | } |
180 | memset(link, 0, sizeof(struct dev_link_t)); | ||
181 | 180 | ||
182 | /* Interrupt setup */ | 181 | /* Interrupt setup */ |
183 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 182 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
@@ -196,13 +195,12 @@ static dev_link_t *airo_attach(void) | |||
196 | link->conf.IntType = INT_MEMORY_AND_IO; | 195 | link->conf.IntType = INT_MEMORY_AND_IO; |
197 | 196 | ||
198 | /* Allocate space for private device-specific data */ | 197 | /* Allocate space for private device-specific data */ |
199 | local = kmalloc(sizeof(local_info_t), GFP_KERNEL); | 198 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
200 | if (!local) { | 199 | if (!local) { |
201 | printk(KERN_ERR "airo_cs: no memory for new device\n"); | 200 | printk(KERN_ERR "airo_cs: no memory for new device\n"); |
202 | kfree (link); | 201 | kfree (link); |
203 | return NULL; | 202 | return NULL; |
204 | } | 203 | } |
205 | memset(local, 0, sizeof(local_info_t)); | ||
206 | link->priv = local; | 204 | link->priv = local; |
207 | 205 | ||
208 | /* Register with Card Services */ | 206 | /* Register with Card Services */ |
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 195cb36619e8..1bd13146c644 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c | |||
@@ -180,12 +180,11 @@ static dev_link_t *atmel_attach(void) | |||
180 | DEBUG(0, "atmel_attach()\n"); | 180 | DEBUG(0, "atmel_attach()\n"); |
181 | 181 | ||
182 | /* Initialize the dev_link_t structure */ | 182 | /* Initialize the dev_link_t structure */ |
183 | link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); | 183 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); |
184 | if (!link) { | 184 | if (!link) { |
185 | printk(KERN_ERR "atmel_cs: no memory for new device\n"); | 185 | printk(KERN_ERR "atmel_cs: no memory for new device\n"); |
186 | return NULL; | 186 | return NULL; |
187 | } | 187 | } |
188 | memset(link, 0, sizeof(struct dev_link_t)); | ||
189 | 188 | ||
190 | /* Interrupt setup */ | 189 | /* Interrupt setup */ |
191 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 190 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
@@ -204,13 +203,12 @@ static dev_link_t *atmel_attach(void) | |||
204 | link->conf.IntType = INT_MEMORY_AND_IO; | 203 | link->conf.IntType = INT_MEMORY_AND_IO; |
205 | 204 | ||
206 | /* Allocate space for private device-specific data */ | 205 | /* Allocate space for private device-specific data */ |
207 | local = kmalloc(sizeof(local_info_t), GFP_KERNEL); | 206 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
208 | if (!local) { | 207 | if (!local) { |
209 | printk(KERN_ERR "atmel_cs: no memory for new device\n"); | 208 | printk(KERN_ERR "atmel_cs: no memory for new device\n"); |
210 | kfree (link); | 209 | kfree (link); |
211 | return NULL; | 210 | return NULL; |
212 | } | 211 | } |
213 | memset(local, 0, sizeof(local_info_t)); | ||
214 | link->priv = local; | 212 | link->priv = local; |
215 | 213 | ||
216 | /* Register with Card Services */ | 214 | /* Register with Card Services */ |
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index ad7f8cd76db9..4f19ac7d63a8 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
@@ -6065,13 +6065,11 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, | |||
6065 | 6065 | ||
6066 | ieee80211_crypt_delayed_deinit(ieee, crypt); | 6066 | ieee80211_crypt_delayed_deinit(ieee, crypt); |
6067 | 6067 | ||
6068 | new_crypt = (struct ieee80211_crypt_data *) | 6068 | new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL); |
6069 | kmalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL); | ||
6070 | if (new_crypt == NULL) { | 6069 | if (new_crypt == NULL) { |
6071 | ret = -ENOMEM; | 6070 | ret = -ENOMEM; |
6072 | goto done; | 6071 | goto done; |
6073 | } | 6072 | } |
6074 | memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); | ||
6075 | new_crypt->ops = ops; | 6073 | new_crypt->ops = ops; |
6076 | if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) | 6074 | if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) |
6077 | new_crypt->priv = new_crypt->ops->init(param->u.crypt.idx); | 6075 | new_crypt->priv = new_crypt->ops->init(param->u.crypt.idx); |
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 4b3c98f5c564..c822cad3333f 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -4608,9 +4608,8 @@ wavelan_attach(void) | |||
4608 | #endif | 4608 | #endif |
4609 | 4609 | ||
4610 | /* Initialize the dev_link_t structure */ | 4610 | /* Initialize the dev_link_t structure */ |
4611 | link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); | 4611 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); |
4612 | if (!link) return NULL; | 4612 | if (!link) return NULL; |
4613 | memset(link, 0, sizeof(struct dev_link_t)); | ||
4614 | 4613 | ||
4615 | /* The io structure describes IO port mapping */ | 4614 | /* The io structure describes IO port mapping */ |
4616 | link->io.NumPorts1 = 8; | 4615 | link->io.NumPorts1 = 8; |
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 3f8c27f0871b..978fdc606781 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c | |||
@@ -1965,10 +1965,9 @@ static dev_link_t *wl3501_attach(void) | |||
1965 | int ret; | 1965 | int ret; |
1966 | 1966 | ||
1967 | /* Initialize the dev_link_t structure */ | 1967 | /* Initialize the dev_link_t structure */ |
1968 | link = kmalloc(sizeof(*link), GFP_KERNEL); | 1968 | link = kzalloc(sizeof(*link), GFP_KERNEL); |
1969 | if (!link) | 1969 | if (!link) |
1970 | goto out; | 1970 | goto out; |
1971 | memset(link, 0, sizeof(struct dev_link_t)); | ||
1972 | 1971 | ||
1973 | /* The io structure describes IO port mapping */ | 1972 | /* The io structure describes IO port mapping */ |
1974 | link->io.NumPorts1 = 16; | 1973 | link->io.NumPorts1 = 16; |