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/comedi | |
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/comedi')
-rw-r--r-- | drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h | 4 | ||||
-rw-r--r-- | drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h | 4 | ||||
-rw-r--r-- | drivers/staging/comedi/drivers/icp_multi.h | 3 |
3 files changed, 3 insertions, 8 deletions
diff --git a/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h b/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h index 3682503e3412..c3284eb0f0ac 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h @@ -260,12 +260,10 @@ void v_pci_card_list_init(unsigned short pci_vendor, char display) for (i_Count = 0; i_Count < 2; i_Count++) { pci_vendor = i_ADDIDATADeviceID[i_Count]; if (pcidev->vendor == pci_vendor) { - amcc = kmalloc(sizeof(*amcc), GFP_KERNEL); + amcc = kzalloc(sizeof(*amcc), GFP_KERNEL); if (amcc == NULL) continue; - memset(amcc, 0, sizeof(*amcc)); - amcc->pcidev = pcidev; if (last) last->next = amcc; diff --git a/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h b/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h index 49141b3558e1..349e93c23e91 100644 --- a/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h +++ b/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h @@ -253,12 +253,10 @@ void v_pci_card_list_init(unsigned short pci_vendor, char display) pci_for_each_dev(pcidev) { if (pcidev->vendor == pci_vendor) { - amcc = kmalloc(sizeof(*amcc), GFP_KERNEL); + amcc = kzalloc(sizeof(*amcc), GFP_KERNEL); if (amcc == NULL) continue; - memset(amcc, 0, sizeof(*amcc)); - amcc->pcidev = pcidev; if (last) { last->next = amcc; diff --git a/drivers/staging/comedi/drivers/icp_multi.h b/drivers/staging/comedi/drivers/icp_multi.h index 8caadc630ed5..2bb96b1d21e7 100644 --- a/drivers/staging/comedi/drivers/icp_multi.h +++ b/drivers/staging/comedi/drivers/icp_multi.h @@ -73,14 +73,13 @@ static void pci_card_list_init(unsigned short pci_vendor, char display) pcidev != NULL; pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { if (pcidev->vendor == pci_vendor) { - inova = kmalloc(sizeof(*inova), GFP_KERNEL); + inova = kzalloc(sizeof(*inova), GFP_KERNEL); if (!inova) { printk ("icp_multi: pci_card_list_init: allocation failed\n"); pci_dev_put(pcidev); break; } - memset(inova, 0, sizeof(*inova)); inova->pcidev = pci_dev_get(pcidev); if (last) { |