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/go7007/go7007-usb.c | |
parent | Staging: udlfb: fix coding style issues (diff) | |
download | linux-dev-7a6cb0d5497418599d2125b670926b75e673861c.tar.xz linux-dev-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/go7007/go7007-usb.c')
-rw-r--r-- | drivers/staging/go7007/go7007-usb.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/staging/go7007/go7007-usb.c b/drivers/staging/go7007/go7007-usb.c index ee278f64a16b..20ed930b588c 100644 --- a/drivers/staging/go7007/go7007-usb.c +++ b/drivers/staging/go7007/go7007-usb.c @@ -670,10 +670,9 @@ static int go7007_usb_onboard_write_interrupt(struct go7007 *go, "go7007-usb: WriteInterrupt: %04x %04x\n", addr, data); #endif - tbuf = kmalloc(8, GFP_KERNEL); + tbuf = kzalloc(8, GFP_KERNEL); if (tbuf == NULL) return -ENOMEM; - memset(tbuf, 0, 8); tbuf[0] = data & 0xff; tbuf[1] = data >> 8; tbuf[2] = addr & 0xff; |