diff options
author | Julia Lawall <julia@diku.dk> | 2010-05-13 16:00:05 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-14 17:02:56 -0400 |
commit | 7a6cb0d5497418599d2125b670926b75e673861c (patch) | |
tree | a698dc86695304ef6aefe4bc6d18fdad7f3770ee /drivers/staging/panel | |
parent | b5a2104c98cb603f7053e4b0309fb88f15d6be86 (diff) |
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/panel')
-rw-r--r-- | drivers/staging/panel/panel.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c index f9fcb2fef5a..9ca0e9e2a96 100644 --- a/drivers/staging/panel/panel.c +++ b/drivers/staging/panel/panel.c | |||
@@ -1906,12 +1906,11 @@ static struct logical_input *panel_bind_key(char *name, char *press, | |||
1906 | { | 1906 | { |
1907 | struct logical_input *key; | 1907 | struct logical_input *key; |
1908 | 1908 | ||
1909 | key = kmalloc(sizeof(struct logical_input), GFP_KERNEL); | 1909 | key = kzalloc(sizeof(struct logical_input), GFP_KERNEL); |
1910 | if (!key) { | 1910 | if (!key) { |
1911 | printk(KERN_ERR "panel: not enough memory\n"); | 1911 | printk(KERN_ERR "panel: not enough memory\n"); |
1912 | return NULL; | 1912 | return NULL; |
1913 | } | 1913 | } |
1914 | memset(key, 0, sizeof(struct logical_input)); | ||
1915 | if (!input_name2mask(name, &key->mask, &key->value, &scan_mask_i, | 1914 | if (!input_name2mask(name, &key->mask, &key->value, &scan_mask_i, |
1916 | &scan_mask_o)) | 1915 | &scan_mask_o)) |
1917 | return NULL; | 1916 | return NULL; |