Thread: [Madwifi-cvs] revision 3573 committed
Status: Beta
Brought to you by:
otaku
From: Matthew W. S. B. <svn...@ma...> - 2008-04-24 14:11:01
|
Project : madwifi Revision : 3573 Author : mentor (Matthew W. S. Bell) Date : 2008-04-24 16:10:42 +0200 (Thu, 24 Apr 2008) Log Message : Convert as many things as possible to use kzalloc Affected Files: * madwifi/trunk/ath/if_ath.c updated * madwifi/trunk/ath/if_ath_radar.c updated * madwifi/trunk/ath/if_athvar.h updated * madwifi/trunk/ath_hal/ah_os.c updated * madwifi/trunk/ath_rate/minstrel/minstrel.c updated * madwifi/trunk/ath_rate/sample/sample.c updated * madwifi/trunk/net80211/ieee80211_linux.c updated Modified: madwifi/trunk/ath/if_ath.c =================================================================== --- madwifi/trunk/ath/if_ath.c 2008-04-24 14:09:57 UTC (rev 3572) +++ madwifi/trunk/ath/if_ath.c 2008-04-24 14:10:42 UTC (rev 3573) @@ -532,8 +532,7 @@ /* Allocate space for dynamically determined maximum VAP count */ sc->sc_bslot = - kmalloc(ath_maxvaps * sizeof(struct ieee80211vap), GFP_KERNEL); - memset(sc->sc_bslot, 0, ath_maxvaps * sizeof(struct ieee80211vap)); + kzalloc(ath_maxvaps * sizeof(struct ieee80211vap), GFP_KERNEL); /* * Cache line size is used to size and align various @@ -5658,12 +5657,11 @@ /* allocate buffers */ bsize = sizeof(struct ath_buf) * nbuf; - bf = kmalloc(bsize, GFP_KERNEL); + bf = kzalloc(bsize, GFP_KERNEL); if (bf == NULL) { error = -ENOMEM; goto fail2; } - memset(bf, 0, bsize); dd->dd_bufptr = bf; STAILQ_INIT(head); @@ -5752,9 +5750,8 @@ { struct ath_softc *sc = vap->iv_ic->ic_dev->priv; const size_t space = sizeof(struct ath_node) + sc->sc_rc->arc_space; - struct ath_node *an = kmalloc(space, GFP_ATOMIC); + struct ath_node *an = kzalloc(space, GFP_ATOMIC); if (an != NULL) { - memset(an, 0, space); an->an_decomp_index = INVALID_DECOMP_INDEX; an->an_avgrssi = ATH_RSSI_DUMMY_MARKER; /* @@ -11271,7 +11268,7 @@ char *dev_name = NULL; space = 5 * sizeof(struct ctl_table) + sizeof(ath_sysctl_template); - sc->sc_sysctls = kmalloc(space, GFP_KERNEL); + sc->sc_sysctls = kzalloc(space, GFP_KERNEL); if (sc->sc_sysctls == NULL) { EPRINTF(sc, "Insufficient memory for sysctl table!\n"); return; @@ -11292,7 +11289,6 @@ strncpy(dev_name, DEV_NAME(sc->sc_dev), strlen(DEV_NAME(sc->sc_dev)) + 1); /* setup the table */ - memset(sc->sc_sysctls, 0, space); sc->sc_sysctls[0].ctl_name = CTL_DEV; sc->sc_sysctls[0].procname = "dev"; sc->sc_sysctls[0].mode = 0555; Modified: madwifi/trunk/ath/if_ath_radar.c =================================================================== --- madwifi/trunk/ath/if_ath_radar.c 2008-04-24 14:09:57 UTC (rev 3572) +++ madwifi/trunk/ath/if_ath_radar.c 2008-04-24 14:10:42 UTC (rev 3573) @@ -1535,11 +1535,9 @@ ath_rp_clear(sc); - sc->sc_rp = (struct ath_rp *)kmalloc( + sc->sc_rp = (struct ath_rp *)kzalloc( sizeof(struct ath_rp) * ATH_RADAR_PULSE_NR, GFP_KERNEL); - memset(sc->sc_rp, 0, sizeof(struct ath_rp) * - ATH_RADAR_PULSE_NR); if (sc->sc_rp == NULL) return; Modified: madwifi/trunk/ath/if_athvar.h =================================================================== --- madwifi/trunk/ath/if_athvar.h 2008-04-24 14:09:57 UTC (rev 3572) +++ madwifi/trunk/ath/if_athvar.h 2008-04-24 14:10:42 UTC (rev 3573) @@ -136,15 +136,12 @@ /* ensure 32-byte alignment of the private area */ alloc_size = sizeof (*dev) + sizeof_priv + 31; - dev = (struct net_device *) kmalloc (alloc_size, GFP_KERNEL); - if (dev == NULL) - { + dev = (struct net_device *)kzalloc(alloc_size, GFP_KERNEL); + if (dev == NULL) { printk(KERN_ERR "alloc_dev: Unable to allocate device memory.\n"); return NULL; } - memset(dev, 0, alloc_size); - if (sizeof_priv) dev->priv = (void *) (((long)(dev + 1) + 31) & ~31); Modified: madwifi/trunk/ath_hal/ah_os.c =================================================================== --- madwifi/trunk/ath_hal/ah_os.c 2008-04-24 14:09:57 UTC (rev 3572) +++ madwifi/trunk/ath_hal/ah_os.c 2008-04-24 14:10:42 UTC (rev 3573) @@ -995,12 +995,7 @@ void * __ahdecl ath_hal_malloc(size_t size) { - void *p; - p = kmalloc(size, GFP_KERNEL); - if (p) - OS_MEMZERO(p, size); - return p; - + return kzalloc(size, GFP_KERNEL); } void __ahdecl Modified: madwifi/trunk/ath_rate/minstrel/minstrel.c =================================================================== --- madwifi/trunk/ath_rate/minstrel/minstrel.c 2008-04-24 14:09:57 UTC (rev 3572) +++ madwifi/trunk/ath_rate/minstrel/minstrel.c 2008-04-24 14:10:42 UTC (rev 3573) @@ -1024,13 +1024,12 @@ struct proc_dir_entry *dp = PDE(inode); struct ieee80211vap *vap = dp->data; - if (!(file->private_data = kmalloc(sizeof(struct proc_ieee80211_priv), - GFP_KERNEL))) + if (!(file->private_data = kzalloc(sizeof(struct proc_ieee80211_priv), + GFP_KERNEL))) return -ENOMEM; /* Initially allocate both read and write buffers */ - pv = (struct proc_ieee80211_priv *) file->private_data; - memset(pv, 0, sizeof(struct proc_ieee80211_priv)); + pv = (struct proc_ieee80211_priv *)file->private_data; pv->rbuf = vmalloc(MAX_PROC_IEEE80211_SIZE); if (!pv->rbuf) { kfree(pv); Modified: madwifi/trunk/ath_rate/sample/sample.c =================================================================== --- madwifi/trunk/ath_rate/sample/sample.c 2008-04-24 14:09:57 UTC (rev 3572) +++ madwifi/trunk/ath_rate/sample/sample.c 2008-04-24 14:10:42 UTC (rev 3573) @@ -1064,13 +1064,12 @@ struct ieee80211vap *vap = dp->data; unsigned long size; - if (!(file->private_data = kmalloc(sizeof(struct proc_ieee80211_priv), - GFP_KERNEL))) + if (!(file->private_data = kzalloc(sizeof(struct proc_ieee80211_priv), + GFP_KERNEL))) return -ENOMEM; /* initially allocate both read and write buffers */ - pv = (struct proc_ieee80211_priv *) file->private_data; - memset(pv, 0, sizeof(struct proc_ieee80211_priv)); + pv = (struct proc_ieee80211_priv *)file->private_data; pv->rbuf = vmalloc(MAX_PROC_IEEE80211_SIZE); if (!pv->rbuf) { kfree(pv); Modified: madwifi/trunk/net80211/ieee80211_linux.c =================================================================== --- madwifi/trunk/net80211/ieee80211_linux.c 2008-04-24 14:09:57 UTC (rev 3572) +++ madwifi/trunk/net80211/ieee80211_linux.c 2008-04-24 14:10:42 UTC (rev 3573) @@ -456,11 +456,11 @@ struct proc_dir_entry *dp = PDE(inode); struct ieee80211vap *vap = dp->data; - if (!(file->private_data = kmalloc(sizeof(struct proc_ieee80211_priv), GFP_KERNEL))) + if (!(file->private_data = kzalloc(sizeof(struct proc_ieee80211_priv), + GFP_KERNEL))) return -ENOMEM; /* initially allocate both read and write buffers */ - pv = (struct proc_ieee80211_priv *) file->private_data; - memset(pv, 0, sizeof(struct proc_ieee80211_priv)); + pv = (struct proc_ieee80211_priv *)file->private_data; pv->rbuf = vmalloc(MAX_PROC_IEEE80211_SIZE); if (!pv->rbuf) { kfree(pv); @@ -744,7 +744,7 @@ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17) */ space = 5 * sizeof(struct ctl_table) + sizeof(ieee80211_sysctl_template); - vap->iv_sysctls = kmalloc(space, GFP_KERNEL); + vap->iv_sysctls = kzalloc(space, GFP_KERNEL); if (vap->iv_sysctls == NULL) { printk("%s: no memory for sysctl table!\n", __func__); return; @@ -762,7 +762,6 @@ strncpy(devname, vap->iv_dev->name, strlen(vap->iv_dev->name) + 1); /* setup the table */ - memset(vap->iv_sysctls, 0, space); vap->iv_sysctls[0].ctl_name = CTL_NET; vap->iv_sysctls[0].procname = "net"; vap->iv_sysctls[0].mode = 0555; |