diff options
author | Julia Lawall | 2010-05-13 22:00:05 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2010-05-14 23:02:56 +0200 |
commit | 7a6cb0d5497418599d2125b670926b75e673861c (patch) | |
tree | a698dc86695304ef6aefe4bc6d18fdad7f3770ee /drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c | |
parent | Staging: udlfb: fix coding style issues (diff) | |
download | kernel-qcow2-linux-7a6cb0d5497418599d2125b670926b75e673861c.tar.gz kernel-qcow2-linux-7a6cb0d5497418599d2125b670926b75e673861c.tar.xz kernel-qcow2-linux-7a6cb0d5497418599d2125b670926b75e673861c.zip |
Staging: Use kcalloc or kzalloc
Use kcalloc or kzalloc rather than the combination of kmalloc and memset.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression x,y,flags;
statement S;
type T;
@@
x =
- kmalloc
+ kcalloc
(
- y * sizeof(T),
+ y, sizeof(T),
flags);
if (x == NULL) S
-memset(x, 0, y * sizeof(T));
@@
expression x,size,flags;
statement S;
@@
-x = kmalloc(size,flags);
+x = kzalloc(size,flags);
if (x == NULL) S
-memset(x, 0, size);
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Diffstat (limited to 'drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c')
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c index 521e7b989934..8707eba4f905 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c @@ -109,11 +109,10 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops) if (hcrypt == NULL) return -1; - alg = kmalloc(sizeof(*alg), GFP_KERNEL); + alg = kzalloc(sizeof(*alg), GFP_KERNEL); if (alg == NULL) return -ENOMEM; - memset(alg, 0, sizeof(*alg)); alg->ops = ops; spin_lock_irqsave(&hcrypt->lock, flags); @@ -206,11 +205,10 @@ int __init ieee80211_crypto_init(void) { int ret = -ENOMEM; - hcrypt = kmalloc(sizeof(*hcrypt), GFP_KERNEL); + hcrypt = kzalloc(sizeof(*hcrypt), GFP_KERNEL); if (!hcrypt) goto out; - memset(hcrypt, 0, sizeof(*hcrypt)); INIT_LIST_HEAD(&hcrypt->algs); spin_lock_init(&hcrypt->lock); |