diff options
author | Julia Lawall <julia@diku.dk> | 2010-05-13 22:00:05 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-14 14:02:56 -0700 |
commit | 7a6cb0d5497418599d2125b670926b75e673861c (patch) | |
tree | a698dc86695304ef6aefe4bc6d18fdad7f3770ee /drivers/staging/rtl8192u/ieee80211/api.c | |
parent | b5a2104c98cb603f7053e4b0309fb88f15d6be86 (diff) | |
download | op-kernel-dev-7a6cb0d5497418599d2125b670926b75e673861c.zip op-kernel-dev-7a6cb0d5497418599d2125b670926b75e673861c.tar.gz |
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/api.c')
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/api.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/staging/rtl8192u/ieee80211/api.c b/drivers/staging/rtl8192u/ieee80211/api.c index c627d02..5f46e50 100644 --- a/drivers/staging/rtl8192u/ieee80211/api.c +++ b/drivers/staging/rtl8192u/ieee80211/api.c @@ -131,12 +131,10 @@ struct crypto_tfm *crypto_alloc_tfm(const char *name, u32 flags) if (alg == NULL) goto out; - tfm = kmalloc(sizeof(*tfm) + alg->cra_ctxsize, GFP_KERNEL); + tfm = kzalloc(sizeof(*tfm) + alg->cra_ctxsize, GFP_KERNEL); if (tfm == NULL) goto out_put; - memset(tfm, 0, sizeof(*tfm) + alg->cra_ctxsize); - tfm->__crt_alg = alg; if (crypto_init_flags(tfm, flags)) |