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-v4l2.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/go7007/go7007-v4l2.c')
-rw-r--r-- | drivers/staging/go7007/go7007-v4l2.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/staging/go7007/go7007-v4l2.c b/drivers/staging/go7007/go7007-v4l2.c index 723c1a6..46b4b9f 100644 --- a/drivers/staging/go7007/go7007-v4l2.c +++ b/drivers/staging/go7007/go7007-v4l2.c @@ -720,7 +720,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, if (count > 32) count = 32; - gofh->bufs = kmalloc(count * sizeof(struct go7007_buffer), + gofh->bufs = kcalloc(count, sizeof(struct go7007_buffer), GFP_KERNEL); if (!gofh->bufs) { @@ -728,8 +728,6 @@ static int vidioc_reqbufs(struct file *file, void *priv, goto unlock_and_return; } - memset(gofh->bufs, 0, count * sizeof(struct go7007_buffer)); - for (i = 0; i < count; ++i) { gofh->bufs[i].go = go; gofh->bufs[i].index = i; |