forked from luck/tmp_suning_uos_patched
[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>
This commit is contained in:
parent
f36be62115
commit
b69a3aa85c
@ -4533,9 +4533,8 @@ static int proc_status_open( struct inode *inode, struct file *file ) {
|
|||||||
StatusRid status_rid;
|
StatusRid status_rid;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
|
if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memset(file->private_data, 0, sizeof(struct proc_data));
|
|
||||||
data = (struct proc_data *)file->private_data;
|
data = (struct proc_data *)file->private_data;
|
||||||
if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) {
|
if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) {
|
||||||
kfree (file->private_data);
|
kfree (file->private_data);
|
||||||
@ -4613,9 +4612,8 @@ static int proc_stats_rid_open( struct inode *inode,
|
|||||||
int i, j;
|
int i, j;
|
||||||
u32 *vals = stats.vals;
|
u32 *vals = stats.vals;
|
||||||
|
|
||||||
if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
|
if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memset(file->private_data, 0, sizeof(struct proc_data));
|
|
||||||
data = (struct proc_data *)file->private_data;
|
data = (struct proc_data *)file->private_data;
|
||||||
if ((data->rbuffer = kmalloc( 4096, GFP_KERNEL )) == NULL) {
|
if ((data->rbuffer = kmalloc( 4096, GFP_KERNEL )) == NULL) {
|
||||||
kfree (file->private_data);
|
kfree (file->private_data);
|
||||||
@ -4879,20 +4877,18 @@ static int proc_config_open( struct inode *inode, struct file *file ) {
|
|||||||
struct airo_info *ai = dev->priv;
|
struct airo_info *ai = dev->priv;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
|
if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memset(file->private_data, 0, sizeof(struct proc_data));
|
|
||||||
data = (struct proc_data *)file->private_data;
|
data = (struct proc_data *)file->private_data;
|
||||||
if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) {
|
if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) {
|
||||||
kfree (file->private_data);
|
kfree (file->private_data);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
if ((data->wbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) {
|
if ((data->wbuffer = kzalloc( 2048, GFP_KERNEL )) == NULL) {
|
||||||
kfree (data->rbuffer);
|
kfree (data->rbuffer);
|
||||||
kfree (file->private_data);
|
kfree (file->private_data);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
memset( data->wbuffer, 0, 2048 );
|
|
||||||
data->maxwritelen = 2048;
|
data->maxwritelen = 2048;
|
||||||
data->on_close = proc_config_on_close;
|
data->on_close = proc_config_on_close;
|
||||||
|
|
||||||
@ -5153,24 +5149,21 @@ static int proc_wepkey_open( struct inode *inode, struct file *file ) {
|
|||||||
int j=0;
|
int j=0;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
|
if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memset(file->private_data, 0, sizeof(struct proc_data));
|
|
||||||
memset(&wkr, 0, sizeof(wkr));
|
memset(&wkr, 0, sizeof(wkr));
|
||||||
data = (struct proc_data *)file->private_data;
|
data = (struct proc_data *)file->private_data;
|
||||||
if ((data->rbuffer = kmalloc( 180, GFP_KERNEL )) == NULL) {
|
if ((data->rbuffer = kzalloc( 180, GFP_KERNEL )) == NULL) {
|
||||||
kfree (file->private_data);
|
kfree (file->private_data);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
memset(data->rbuffer, 0, 180);
|
|
||||||
data->writelen = 0;
|
data->writelen = 0;
|
||||||
data->maxwritelen = 80;
|
data->maxwritelen = 80;
|
||||||
if ((data->wbuffer = kmalloc( 80, GFP_KERNEL )) == NULL) {
|
if ((data->wbuffer = kzalloc( 80, GFP_KERNEL )) == NULL) {
|
||||||
kfree (data->rbuffer);
|
kfree (data->rbuffer);
|
||||||
kfree (file->private_data);
|
kfree (file->private_data);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
memset( data->wbuffer, 0, 80 );
|
|
||||||
data->on_close = proc_wepkey_on_close;
|
data->on_close = proc_wepkey_on_close;
|
||||||
|
|
||||||
ptr = data->rbuffer;
|
ptr = data->rbuffer;
|
||||||
@ -5201,9 +5194,8 @@ static int proc_SSID_open( struct inode *inode, struct file *file ) {
|
|||||||
char *ptr;
|
char *ptr;
|
||||||
SsidRid SSID_rid;
|
SsidRid SSID_rid;
|
||||||
|
|
||||||
if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
|
if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memset(file->private_data, 0, sizeof(struct proc_data));
|
|
||||||
data = (struct proc_data *)file->private_data;
|
data = (struct proc_data *)file->private_data;
|
||||||
if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) {
|
if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) {
|
||||||
kfree (file->private_data);
|
kfree (file->private_data);
|
||||||
@ -5211,12 +5203,11 @@ static int proc_SSID_open( struct inode *inode, struct file *file ) {
|
|||||||
}
|
}
|
||||||
data->writelen = 0;
|
data->writelen = 0;
|
||||||
data->maxwritelen = 33*3;
|
data->maxwritelen = 33*3;
|
||||||
if ((data->wbuffer = kmalloc( 33*3, GFP_KERNEL )) == NULL) {
|
if ((data->wbuffer = kzalloc( 33*3, GFP_KERNEL )) == NULL) {
|
||||||
kfree (data->rbuffer);
|
kfree (data->rbuffer);
|
||||||
kfree (file->private_data);
|
kfree (file->private_data);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
memset( data->wbuffer, 0, 33*3 );
|
|
||||||
data->on_close = proc_SSID_on_close;
|
data->on_close = proc_SSID_on_close;
|
||||||
|
|
||||||
readSsidRid(ai, &SSID_rid);
|
readSsidRid(ai, &SSID_rid);
|
||||||
@ -5245,9 +5236,8 @@ static int proc_APList_open( struct inode *inode, struct file *file ) {
|
|||||||
char *ptr;
|
char *ptr;
|
||||||
APListRid APList_rid;
|
APListRid APList_rid;
|
||||||
|
|
||||||
if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
|
if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memset(file->private_data, 0, sizeof(struct proc_data));
|
|
||||||
data = (struct proc_data *)file->private_data;
|
data = (struct proc_data *)file->private_data;
|
||||||
if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) {
|
if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) {
|
||||||
kfree (file->private_data);
|
kfree (file->private_data);
|
||||||
@ -5255,12 +5245,11 @@ static int proc_APList_open( struct inode *inode, struct file *file ) {
|
|||||||
}
|
}
|
||||||
data->writelen = 0;
|
data->writelen = 0;
|
||||||
data->maxwritelen = 4*6*3;
|
data->maxwritelen = 4*6*3;
|
||||||
if ((data->wbuffer = kmalloc( data->maxwritelen, GFP_KERNEL )) == NULL) {
|
if ((data->wbuffer = kzalloc( data->maxwritelen, GFP_KERNEL )) == NULL) {
|
||||||
kfree (data->rbuffer);
|
kfree (data->rbuffer);
|
||||||
kfree (file->private_data);
|
kfree (file->private_data);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
memset( data->wbuffer, 0, data->maxwritelen );
|
|
||||||
data->on_close = proc_APList_on_close;
|
data->on_close = proc_APList_on_close;
|
||||||
|
|
||||||
readAPListRid(ai, &APList_rid);
|
readAPListRid(ai, &APList_rid);
|
||||||
@ -5295,9 +5284,8 @@ static int proc_BSSList_open( struct inode *inode, struct file *file ) {
|
|||||||
/* If doLoseSync is not 1, we won't do a Lose Sync */
|
/* If doLoseSync is not 1, we won't do a Lose Sync */
|
||||||
int doLoseSync = -1;
|
int doLoseSync = -1;
|
||||||
|
|
||||||
if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
|
if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memset(file->private_data, 0, sizeof(struct proc_data));
|
|
||||||
data = (struct proc_data *)file->private_data;
|
data = (struct proc_data *)file->private_data;
|
||||||
if ((data->rbuffer = kmalloc( 1024, GFP_KERNEL )) == NULL) {
|
if ((data->rbuffer = kmalloc( 1024, GFP_KERNEL )) == NULL) {
|
||||||
kfree (file->private_data);
|
kfree (file->private_data);
|
||||||
|
@ -172,12 +172,11 @@ static dev_link_t *airo_attach(void)
|
|||||||
DEBUG(0, "airo_attach()\n");
|
DEBUG(0, "airo_attach()\n");
|
||||||
|
|
||||||
/* Initialize the dev_link_t structure */
|
/* Initialize the dev_link_t structure */
|
||||||
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
|
link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL);
|
||||||
if (!link) {
|
if (!link) {
|
||||||
printk(KERN_ERR "airo_cs: no memory for new device\n");
|
printk(KERN_ERR "airo_cs: no memory for new device\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(link, 0, sizeof(struct dev_link_t));
|
|
||||||
|
|
||||||
/* Interrupt setup */
|
/* Interrupt setup */
|
||||||
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
|
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
|
||||||
@ -196,13 +195,12 @@ static dev_link_t *airo_attach(void)
|
|||||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||||
|
|
||||||
/* Allocate space for private device-specific data */
|
/* Allocate space for private device-specific data */
|
||||||
local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
|
local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||||
if (!local) {
|
if (!local) {
|
||||||
printk(KERN_ERR "airo_cs: no memory for new device\n");
|
printk(KERN_ERR "airo_cs: no memory for new device\n");
|
||||||
kfree (link);
|
kfree (link);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(local, 0, sizeof(local_info_t));
|
|
||||||
link->priv = local;
|
link->priv = local;
|
||||||
|
|
||||||
/* Register with Card Services */
|
/* Register with Card Services */
|
||||||
|
@ -180,12 +180,11 @@ static dev_link_t *atmel_attach(void)
|
|||||||
DEBUG(0, "atmel_attach()\n");
|
DEBUG(0, "atmel_attach()\n");
|
||||||
|
|
||||||
/* Initialize the dev_link_t structure */
|
/* Initialize the dev_link_t structure */
|
||||||
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
|
link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL);
|
||||||
if (!link) {
|
if (!link) {
|
||||||
printk(KERN_ERR "atmel_cs: no memory for new device\n");
|
printk(KERN_ERR "atmel_cs: no memory for new device\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(link, 0, sizeof(struct dev_link_t));
|
|
||||||
|
|
||||||
/* Interrupt setup */
|
/* Interrupt setup */
|
||||||
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
|
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
|
||||||
@ -204,13 +203,12 @@ static dev_link_t *atmel_attach(void)
|
|||||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||||
|
|
||||||
/* Allocate space for private device-specific data */
|
/* Allocate space for private device-specific data */
|
||||||
local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
|
local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||||
if (!local) {
|
if (!local) {
|
||||||
printk(KERN_ERR "atmel_cs: no memory for new device\n");
|
printk(KERN_ERR "atmel_cs: no memory for new device\n");
|
||||||
kfree (link);
|
kfree (link);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(local, 0, sizeof(local_info_t));
|
|
||||||
link->priv = local;
|
link->priv = local;
|
||||||
|
|
||||||
/* Register with Card Services */
|
/* Register with Card Services */
|
||||||
|
@ -6065,13 +6065,11 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev,
|
|||||||
|
|
||||||
ieee80211_crypt_delayed_deinit(ieee, crypt);
|
ieee80211_crypt_delayed_deinit(ieee, crypt);
|
||||||
|
|
||||||
new_crypt = (struct ieee80211_crypt_data *)
|
new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL);
|
||||||
kmalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL);
|
|
||||||
if (new_crypt == NULL) {
|
if (new_crypt == NULL) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
|
|
||||||
new_crypt->ops = ops;
|
new_crypt->ops = ops;
|
||||||
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
|
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
|
||||||
new_crypt->priv = new_crypt->ops->init(param->u.crypt.idx);
|
new_crypt->priv = new_crypt->ops->init(param->u.crypt.idx);
|
||||||
|
@ -4608,9 +4608,8 @@ wavelan_attach(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initialize the dev_link_t structure */
|
/* Initialize the dev_link_t structure */
|
||||||
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
|
link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL);
|
||||||
if (!link) return NULL;
|
if (!link) return NULL;
|
||||||
memset(link, 0, sizeof(struct dev_link_t));
|
|
||||||
|
|
||||||
/* The io structure describes IO port mapping */
|
/* The io structure describes IO port mapping */
|
||||||
link->io.NumPorts1 = 8;
|
link->io.NumPorts1 = 8;
|
||||||
|
@ -1965,10 +1965,9 @@ static dev_link_t *wl3501_attach(void)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Initialize the dev_link_t structure */
|
/* Initialize the dev_link_t structure */
|
||||||
link = kmalloc(sizeof(*link), GFP_KERNEL);
|
link = kzalloc(sizeof(*link), GFP_KERNEL);
|
||||||
if (!link)
|
if (!link)
|
||||||
goto out;
|
goto out;
|
||||||
memset(link, 0, sizeof(struct dev_link_t));
|
|
||||||
|
|
||||||
/* The io structure describes IO port mapping */
|
/* The io structure describes IO port mapping */
|
||||||
link->io.NumPorts1 = 16;
|
link->io.NumPorts1 = 16;
|
||||||
|
Loading…
Reference in New Issue
Block a user