[PATCH] bluetooth: kmalloc + memset -> kzalloc conversion
authorDeepak Saxena <dsaxena@plexity.net>
Mon, 7 Nov 2005 09:01:26 +0000 (01:01 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 7 Nov 2005 15:54:00 +0000 (07:54 -0800)
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>
12 files changed:
drivers/bluetooth/bcm203x.c
drivers/bluetooth/bfusb.c
drivers/bluetooth/bluecard_cs.c
drivers/bluetooth/bpa10x.c
drivers/bluetooth/bt3c_cs.c
drivers/bluetooth/btuart_cs.c
drivers/bluetooth/dtl1_cs.c
drivers/bluetooth/hci_bcsp.c
drivers/bluetooth/hci_h4.c
drivers/bluetooth/hci_ldisc.c
drivers/bluetooth/hci_usb.c
drivers/bluetooth/hci_vhci.c

index 5fd3e4cb7525a94e376d03a10a6cf18768d5ef5d..8e7fb355177528fe544d32a990d5d7849ed85fda 100644 (file)
@@ -179,14 +179,12 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id
        if (ignore || (intf->cur_altsetting->desc.bInterfaceNumber != 0))
                return -ENODEV;
 
-       data = kmalloc(sizeof(*data), GFP_KERNEL);
+       data = kzalloc(sizeof(*data), GFP_KERNEL);
        if (!data) {
                BT_ERR("Can't allocate memory for data structure");
                return -ENOMEM;
        }
 
-       memset(data, 0, sizeof(*data));
-
        data->udev  = udev;
        data->state = BCM203X_LOAD_MINIDRV;
 
index 1e9db0156ea7d5e574f62cf08283fd5bd19f45f3..067e27893e4a8e4d5b1cbcc1692edd26d0034228 100644 (file)
@@ -673,13 +673,11 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
        }
 
        /* Initialize control structure and load firmware */
-       if (!(bfusb = kmalloc(sizeof(struct bfusb), GFP_KERNEL))) {
+       if (!(bfusb = kzalloc(sizeof(struct bfusb), GFP_KERNEL))) {
                BT_ERR("Can't allocate memory for control structure");
                goto done;
        }
 
-       memset(bfusb, 0, sizeof(struct bfusb));
-
        bfusb->udev = udev;
        bfusb->bulk_in_ep    = bulk_in_ep->desc.bEndpointAddress;
        bfusb->bulk_out_ep   = bulk_out_ep->desc.bEndpointAddress;
index 26fe9c0e1d20e4c1ef51c47428cf5672ae5db56c..f36c563d72c4f49f8334ee8e6a9ee3c8793f51a9 100644 (file)
@@ -870,10 +870,9 @@ static dev_link_t *bluecard_attach(void)
        int ret;
 
        /* Create new info device */
-       info = kmalloc(sizeof(*info), GFP_KERNEL);
+       info = kzalloc(sizeof(*info), GFP_KERNEL);
        if (!info)
                return NULL;
-       memset(info, 0, sizeof(*info));
 
        link = &info->link;
        link->priv = info;
index 0db0400519c95ee5f32bd576f371580ae8c6f463..ecbeb7eaba8e25c3c45ee0a8de1cd8163a8446b8 100644 (file)
@@ -553,14 +553,12 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id *
        if (intf->cur_altsetting->desc.bInterfaceNumber > 0)
                return -ENODEV;
 
-       data = kmalloc(sizeof(*data), GFP_KERNEL);
+       data = kzalloc(sizeof(*data), GFP_KERNEL);
        if (!data) {
                BT_ERR("Can't allocate data structure");
                return -ENOMEM;
        }
 
-       memset(data, 0, sizeof(*data));
-
        data->udev = udev;
 
        rwlock_init(&data->lock);
index 2e0338d80f32c1db8ba8e2f1a4e524e08298aeb6..d2a0add19cc88a52ddcd703495fdcf0584b00022 100644 (file)
@@ -671,10 +671,9 @@ static dev_link_t *bt3c_attach(void)
        int ret;
 
        /* Create new info device */
-       info = kmalloc(sizeof(*info), GFP_KERNEL);
+       info = kzalloc(sizeof(*info), GFP_KERNEL);
        if (!info)
                return NULL;
-       memset(info, 0, sizeof(*info));
 
        link = &info->link;
        link->priv = info;
index 89486ea7a0216db3712b3182fddde49824920d15..529a28a3209d1999961b12b02b6eba8ea80b7b63 100644 (file)
@@ -590,10 +590,9 @@ static dev_link_t *btuart_attach(void)
        int ret;
 
        /* Create new info device */
-       info = kmalloc(sizeof(*info), GFP_KERNEL);
+       info = kzalloc(sizeof(*info), GFP_KERNEL);
        if (!info)
                return NULL;
-       memset(info, 0, sizeof(*info));
 
        link = &info->link;
        link->priv = info;
index 84c1f88394225504ff7c2e02f77a8f043db85960..dec5980a1cd6811f79906b278ed09c0cf9d70c44 100644 (file)
@@ -569,10 +569,9 @@ static dev_link_t *dtl1_attach(void)
        int ret;
 
        /* Create new info device */
-       info = kmalloc(sizeof(*info), GFP_KERNEL);
+       info = kzalloc(sizeof(*info), GFP_KERNEL);
        if (!info)
                return NULL;
-       memset(info, 0, sizeof(*info));
 
        link = &info->link;
        link->priv = info;
index 0a4761415ac39be6cedd01b0d77c4cb570bd2495..8fddfdfd0fbdcca1c779cc12736051f8c9439c6c 100644 (file)
@@ -715,10 +715,9 @@ static int bcsp_open(struct hci_uart *hu)
 
        BT_DBG("hu %p", hu);
 
-       bcsp = kmalloc(sizeof(*bcsp), GFP_ATOMIC);
+       bcsp = kzalloc(sizeof(*bcsp), GFP_ATOMIC);
        if (!bcsp)
                return -ENOMEM;
-       memset(bcsp, 0, sizeof(*bcsp));
 
        hu->priv = bcsp;
        skb_queue_head_init(&bcsp->unack);
index 12e369a66fc24be1e2dba29cae82a679576ca32d..4804d474dc8735d4a2365258385551134134c616 100644 (file)
@@ -76,12 +76,10 @@ static int h4_open(struct hci_uart *hu)
 
        BT_DBG("hu %p", hu);
 
-       h4 = kmalloc(sizeof(*h4), GFP_ATOMIC);
+       h4 = kzalloc(sizeof(*h4), GFP_ATOMIC);
        if (!h4)
                return -ENOMEM;
 
-       memset(h4, 0, sizeof(*h4));
-
        skb_queue_head_init(&h4->txq);
 
        hu->priv = h4;
index 4a775f6ea3907134fe8f0fa64b69086bc515e31a..573ff6c1be5f6080362407f17f0785729317025c 100644 (file)
@@ -272,13 +272,11 @@ static int hci_uart_tty_open(struct tty_struct *tty)
        if (hu)
                return -EEXIST;
 
-       if (!(hu = kmalloc(sizeof(struct hci_uart), GFP_KERNEL))) {
+       if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) {
                BT_ERR("Can't allocate controll structure");
                return -ENFILE;
        }
 
-       memset(hu, 0, sizeof(struct hci_uart));
-
        tty->disc_data = hu;
        hu->tty = tty;
 
index 6756cb20b753875e7a22cc3c7f047d2e134b9ea6..f510b25b2c59010c0967e4488eebccbeaee994cc 100644 (file)
@@ -875,13 +875,11 @@ static int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id
                goto done;
        }
 
-       if (!(husb = kmalloc(sizeof(struct hci_usb), GFP_KERNEL))) {
+       if (!(husb = kzalloc(sizeof(struct hci_usb), GFP_KERNEL))) {
                BT_ERR("Can't allocate: control structure");
                goto done;
        }
 
-       memset(husb, 0, sizeof(struct hci_usb));
-
        husb->udev = udev;
        husb->bulk_out_ep = bulk_out_ep;
        husb->bulk_in_ep  = bulk_in_ep;
index 52cbd45c308fa0189d9d0a6ef044ebc49651a379..85738223ff0c47648c50b5985652baa0e1387e87 100644 (file)
@@ -261,12 +261,10 @@ static int vhci_open(struct inode *inode, struct file *file)
        struct vhci_data *vhci;
        struct hci_dev *hdev;
 
-       vhci = kmalloc(sizeof(struct vhci_data), GFP_KERNEL);
+       vhci = kzalloc(sizeof(struct vhci_data), GFP_KERNEL);
        if (!vhci)
                return -ENOMEM;
 
-       memset(vhci, 0, sizeof(struct vhci_data));
-
        skb_queue_head_init(&vhci->readq);
        init_waitqueue_head(&vhci->read_wait);