]> Pileus Git - ~andy/linux/commitdiff
[PATCH] wireless net: Conversions of kmalloc/memset to kzalloc
authorPanagiotis Issaris <takis@issaris.org>
Mon, 7 Nov 2005 23:03:15 +0000 (00:03 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 8 Nov 2005 02:50:01 +0000 (21:50 -0500)
More conversions of kmalloc/memset to kzalloc

Signed-off-by: Panagiotis Issaris <takis@issaris.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/airo.c
drivers/net/wireless/airo_cs.c
drivers/net/wireless/atmel_cs.c
drivers/net/wireless/ipw2100.c
drivers/net/wireless/wavelan_cs.c
drivers/net/wireless/wl3501_cs.c

index 849ac88bcccc217bb4aa83aa41be050a23968f7f..58ca585caa59d79525467ebd38426ff8b481d3cb 100644 (file)
@@ -4533,9 +4533,8 @@ static int proc_status_open( struct inode *inode, struct file *file ) {
        StatusRid status_rid;
        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;
-       memset(file->private_data, 0, sizeof(struct proc_data));
        data = (struct proc_data *)file->private_data;
        if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) {
                kfree (file->private_data);
@@ -4613,9 +4612,8 @@ static int proc_stats_rid_open( struct inode *inode,
        int i, j;
        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;
-       memset(file->private_data, 0, sizeof(struct proc_data));
        data = (struct proc_data *)file->private_data;
        if ((data->rbuffer = kmalloc( 4096, GFP_KERNEL )) == NULL) {
                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;
        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;
-       memset(file->private_data, 0, sizeof(struct proc_data));
        data = (struct proc_data *)file->private_data;
        if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) {
                kfree (file->private_data);
                return -ENOMEM;
        }
-       if ((data->wbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) {
+       if ((data->wbuffer = kzalloc( 2048, GFP_KERNEL )) == NULL) {
                kfree (data->rbuffer);
                kfree (file->private_data);
                return -ENOMEM;
        }
-       memset( data->wbuffer, 0, 2048 );
        data->maxwritelen = 2048;
        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 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;
-       memset(file->private_data, 0, sizeof(struct proc_data));
        memset(&wkr, 0, sizeof(wkr));
        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);
                return -ENOMEM;
        }
-       memset(data->rbuffer, 0, 180);
        data->writelen = 0;
        data->maxwritelen = 80;
-       if ((data->wbuffer = kmalloc( 80, GFP_KERNEL )) == NULL) {
+       if ((data->wbuffer = kzalloc( 80, GFP_KERNEL )) == NULL) {
                kfree (data->rbuffer);
                kfree (file->private_data);
                return -ENOMEM;
        }
-       memset( data->wbuffer, 0, 80 );
        data->on_close = proc_wepkey_on_close;
 
        ptr = data->rbuffer;
@@ -5201,9 +5194,8 @@ static int proc_SSID_open( struct inode *inode, struct file *file ) {
        char *ptr;
        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;
-       memset(file->private_data, 0, sizeof(struct proc_data));
        data = (struct proc_data *)file->private_data;
        if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) {
                kfree (file->private_data);
@@ -5211,12 +5203,11 @@ static int proc_SSID_open( struct inode *inode, struct file *file ) {
        }
        data->writelen = 0;
        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 (file->private_data);
                return -ENOMEM;
        }
-       memset( data->wbuffer, 0, 33*3 );
        data->on_close = proc_SSID_on_close;
 
        readSsidRid(ai, &SSID_rid);
@@ -5245,9 +5236,8 @@ static int proc_APList_open( struct inode *inode, struct file *file ) {
        char *ptr;
        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;
-       memset(file->private_data, 0, sizeof(struct proc_data));
        data = (struct proc_data *)file->private_data;
        if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) {
                kfree (file->private_data);
@@ -5255,12 +5245,11 @@ static int proc_APList_open( struct inode *inode, struct file *file ) {
        }
        data->writelen = 0;
        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 (file->private_data);
                return -ENOMEM;
        }
-       memset( data->wbuffer, 0, data->maxwritelen );
        data->on_close = proc_APList_on_close;
 
        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 */
        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;
-       memset(file->private_data, 0, sizeof(struct proc_data));
        data = (struct proc_data *)file->private_data;
        if ((data->rbuffer = kmalloc( 1024, GFP_KERNEL )) == NULL) {
                kfree (file->private_data);
index 784de9109113bac53a86d879bb28e245451bc755..fee458fd7a4ab1ccf3f117c0a53ce3bb45c18c77 100644 (file)
@@ -172,12 +172,11 @@ static dev_link_t *airo_attach(void)
        DEBUG(0, "airo_attach()\n");
 
        /* 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) {
                printk(KERN_ERR "airo_cs: no memory for new device\n");
                return NULL;
        }
-       memset(link, 0, sizeof(struct dev_link_t));
        
        /* Interrupt setup */
        link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
@@ -196,13 +195,12 @@ static dev_link_t *airo_attach(void)
        link->conf.IntType = INT_MEMORY_AND_IO;
        
        /* 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) {
                printk(KERN_ERR "airo_cs: no memory for new device\n");
                kfree (link);
                return NULL;
        }
-       memset(local, 0, sizeof(local_info_t));
        link->priv = local;
        
        /* Register with Card Services */
index 195cb36619e859ea2475ee3032adc78d9826e9ec..1bd13146c644c1673b00546706deac2090cfbe31 100644 (file)
@@ -180,12 +180,11 @@ static dev_link_t *atmel_attach(void)
        DEBUG(0, "atmel_attach()\n");
 
        /* 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) {
                printk(KERN_ERR "atmel_cs: no memory for new device\n");
                return NULL;
        }
-       memset(link, 0, sizeof(struct dev_link_t));
        
        /* Interrupt setup */
        link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
@@ -204,13 +203,12 @@ static dev_link_t *atmel_attach(void)
        link->conf.IntType = INT_MEMORY_AND_IO;
        
        /* 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) {
                printk(KERN_ERR "atmel_cs: no memory for new device\n");
                kfree (link);
                return NULL;
        }
-       memset(local, 0, sizeof(local_info_t));
        link->priv = local;
        
        /* Register with Card Services */
index ad7f8cd76db9041376b19a024a74dc38ac5854b4..4f19ac7d63a8ed4273eb3cdb01bfa8955c1d40ac 100644 (file)
@@ -6065,13 +6065,11 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev,
 
                ieee80211_crypt_delayed_deinit(ieee, crypt);
 
-               new_crypt = (struct ieee80211_crypt_data *)
-                       kmalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL);
+               new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL);
                if (new_crypt == NULL) {
                        ret = -ENOMEM;
                        goto done;
                }
-               memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
                new_crypt->ops = ops;
                if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
                        new_crypt->priv = new_crypt->ops->init(param->u.crypt.idx);
index 4b3c98f5c564fba27800d496cd42695419924c65..c822cad3333f3bba7cff1cd3608cfa8455430132 100644 (file)
@@ -4608,9 +4608,8 @@ wavelan_attach(void)
 #endif
 
   /* 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;
-  memset(link, 0, sizeof(struct dev_link_t));
 
   /* The io structure describes IO port mapping */
   link->io.NumPorts1 = 8;
index 3f8c27f0871be01905cf61458845304e8e4e210d..978fdc6067818ad00c2322b3ce054e3121e122ff 100644 (file)
@@ -1965,10 +1965,9 @@ static dev_link_t *wl3501_attach(void)
        int ret;
 
        /* Initialize the dev_link_t structure */
-       link = kmalloc(sizeof(*link), GFP_KERNEL);
+       link = kzalloc(sizeof(*link), GFP_KERNEL);
        if (!link)
                goto out;
-       memset(link, 0, sizeof(struct dev_link_t));
 
        /* The io structure describes IO port mapping */
        link->io.NumPorts1      = 16;