Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] bluetooth: kmalloc + memset -> kzalloc conversion

Signed-off-by: Deepak Saxena <dsaxena@plexity.net>
Cc: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Deepak Saxena and committed by
Linus Torvalds
089b1dbb f5e3c2fa

+12 -31
+1 -3
drivers/bluetooth/bcm203x.c
··· 179 179 if (ignore || (intf->cur_altsetting->desc.bInterfaceNumber != 0)) 180 180 return -ENODEV; 181 181 182 - data = kmalloc(sizeof(*data), GFP_KERNEL); 182 + data = kzalloc(sizeof(*data), GFP_KERNEL); 183 183 if (!data) { 184 184 BT_ERR("Can't allocate memory for data structure"); 185 185 return -ENOMEM; 186 186 } 187 - 188 - memset(data, 0, sizeof(*data)); 189 187 190 188 data->udev = udev; 191 189 data->state = BCM203X_LOAD_MINIDRV;
+1 -3
drivers/bluetooth/bfusb.c
··· 673 673 } 674 674 675 675 /* Initialize control structure and load firmware */ 676 - if (!(bfusb = kmalloc(sizeof(struct bfusb), GFP_KERNEL))) { 676 + if (!(bfusb = kzalloc(sizeof(struct bfusb), GFP_KERNEL))) { 677 677 BT_ERR("Can't allocate memory for control structure"); 678 678 goto done; 679 679 } 680 - 681 - memset(bfusb, 0, sizeof(struct bfusb)); 682 680 683 681 bfusb->udev = udev; 684 682 bfusb->bulk_in_ep = bulk_in_ep->desc.bEndpointAddress;
+1 -2
drivers/bluetooth/bluecard_cs.c
··· 870 870 int ret; 871 871 872 872 /* Create new info device */ 873 - info = kmalloc(sizeof(*info), GFP_KERNEL); 873 + info = kzalloc(sizeof(*info), GFP_KERNEL); 874 874 if (!info) 875 875 return NULL; 876 - memset(info, 0, sizeof(*info)); 877 876 878 877 link = &info->link; 879 878 link->priv = info;
+1 -3
drivers/bluetooth/bpa10x.c
··· 553 553 if (intf->cur_altsetting->desc.bInterfaceNumber > 0) 554 554 return -ENODEV; 555 555 556 - data = kmalloc(sizeof(*data), GFP_KERNEL); 556 + data = kzalloc(sizeof(*data), GFP_KERNEL); 557 557 if (!data) { 558 558 BT_ERR("Can't allocate data structure"); 559 559 return -ENOMEM; 560 560 } 561 - 562 - memset(data, 0, sizeof(*data)); 563 561 564 562 data->udev = udev; 565 563
+1 -2
drivers/bluetooth/bt3c_cs.c
··· 671 671 int ret; 672 672 673 673 /* Create new info device */ 674 - info = kmalloc(sizeof(*info), GFP_KERNEL); 674 + info = kzalloc(sizeof(*info), GFP_KERNEL); 675 675 if (!info) 676 676 return NULL; 677 - memset(info, 0, sizeof(*info)); 678 677 679 678 link = &info->link; 680 679 link->priv = info;
+1 -2
drivers/bluetooth/btuart_cs.c
··· 590 590 int ret; 591 591 592 592 /* Create new info device */ 593 - info = kmalloc(sizeof(*info), GFP_KERNEL); 593 + info = kzalloc(sizeof(*info), GFP_KERNEL); 594 594 if (!info) 595 595 return NULL; 596 - memset(info, 0, sizeof(*info)); 597 596 598 597 link = &info->link; 599 598 link->priv = info;
+1 -2
drivers/bluetooth/dtl1_cs.c
··· 569 569 int ret; 570 570 571 571 /* Create new info device */ 572 - info = kmalloc(sizeof(*info), GFP_KERNEL); 572 + info = kzalloc(sizeof(*info), GFP_KERNEL); 573 573 if (!info) 574 574 return NULL; 575 - memset(info, 0, sizeof(*info)); 576 575 577 576 link = &info->link; 578 577 link->priv = info;
+1 -2
drivers/bluetooth/hci_bcsp.c
··· 715 715 716 716 BT_DBG("hu %p", hu); 717 717 718 - bcsp = kmalloc(sizeof(*bcsp), GFP_ATOMIC); 718 + bcsp = kzalloc(sizeof(*bcsp), GFP_ATOMIC); 719 719 if (!bcsp) 720 720 return -ENOMEM; 721 - memset(bcsp, 0, sizeof(*bcsp)); 722 721 723 722 hu->priv = bcsp; 724 723 skb_queue_head_init(&bcsp->unack);
+1 -3
drivers/bluetooth/hci_h4.c
··· 76 76 77 77 BT_DBG("hu %p", hu); 78 78 79 - h4 = kmalloc(sizeof(*h4), GFP_ATOMIC); 79 + h4 = kzalloc(sizeof(*h4), GFP_ATOMIC); 80 80 if (!h4) 81 81 return -ENOMEM; 82 - 83 - memset(h4, 0, sizeof(*h4)); 84 82 85 83 skb_queue_head_init(&h4->txq); 86 84
+1 -3
drivers/bluetooth/hci_ldisc.c
··· 272 272 if (hu) 273 273 return -EEXIST; 274 274 275 - if (!(hu = kmalloc(sizeof(struct hci_uart), GFP_KERNEL))) { 275 + if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) { 276 276 BT_ERR("Can't allocate controll structure"); 277 277 return -ENFILE; 278 278 } 279 - 280 - memset(hu, 0, sizeof(struct hci_uart)); 281 279 282 280 tty->disc_data = hu; 283 281 hu->tty = tty;
+1 -3
drivers/bluetooth/hci_usb.c
··· 875 875 goto done; 876 876 } 877 877 878 - if (!(husb = kmalloc(sizeof(struct hci_usb), GFP_KERNEL))) { 878 + if (!(husb = kzalloc(sizeof(struct hci_usb), GFP_KERNEL))) { 879 879 BT_ERR("Can't allocate: control structure"); 880 880 goto done; 881 881 } 882 - 883 - memset(husb, 0, sizeof(struct hci_usb)); 884 882 885 883 husb->udev = udev; 886 884 husb->bulk_out_ep = bulk_out_ep;
+1 -3
drivers/bluetooth/hci_vhci.c
··· 261 261 struct vhci_data *vhci; 262 262 struct hci_dev *hdev; 263 263 264 - vhci = kmalloc(sizeof(struct vhci_data), GFP_KERNEL); 264 + vhci = kzalloc(sizeof(struct vhci_data), GFP_KERNEL); 265 265 if (!vhci) 266 266 return -ENOMEM; 267 - 268 - memset(vhci, 0, sizeof(struct vhci_data)); 269 267 270 268 skb_queue_head_init(&vhci->readq); 271 269 init_waitqueue_head(&vhci->read_wait);