Commit 089b1dbb authored by Deepak Saxena's avatar Deepak Saxena Committed by Linus Torvalds

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

Signed-off-by: default avatarDeepak Saxena <dsaxena@plexity.net>
Cc: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f5e3c2fa
...@@ -179,14 +179,12 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id ...@@ -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)) if (ignore || (intf->cur_altsetting->desc.bInterfaceNumber != 0))
return -ENODEV; return -ENODEV;
data = kmalloc(sizeof(*data), GFP_KERNEL); data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data) { if (!data) {
BT_ERR("Can't allocate memory for data structure"); BT_ERR("Can't allocate memory for data structure");
return -ENOMEM; return -ENOMEM;
} }
memset(data, 0, sizeof(*data));
data->udev = udev; data->udev = udev;
data->state = BCM203X_LOAD_MINIDRV; data->state = BCM203X_LOAD_MINIDRV;
......
...@@ -673,13 +673,11 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i ...@@ -673,13 +673,11 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
} }
/* Initialize control structure and load firmware */ /* 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"); BT_ERR("Can't allocate memory for control structure");
goto done; goto done;
} }
memset(bfusb, 0, sizeof(struct bfusb));
bfusb->udev = udev; bfusb->udev = udev;
bfusb->bulk_in_ep = bulk_in_ep->desc.bEndpointAddress; bfusb->bulk_in_ep = bulk_in_ep->desc.bEndpointAddress;
bfusb->bulk_out_ep = bulk_out_ep->desc.bEndpointAddress; bfusb->bulk_out_ep = bulk_out_ep->desc.bEndpointAddress;
......
...@@ -870,10 +870,9 @@ static dev_link_t *bluecard_attach(void) ...@@ -870,10 +870,9 @@ static dev_link_t *bluecard_attach(void)
int ret; int ret;
/* Create new info device */ /* Create new info device */
info = kmalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) if (!info)
return NULL; return NULL;
memset(info, 0, sizeof(*info));
link = &info->link; link = &info->link;
link->priv = info; link->priv = info;
......
...@@ -553,14 +553,12 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id * ...@@ -553,14 +553,12 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id *
if (intf->cur_altsetting->desc.bInterfaceNumber > 0) if (intf->cur_altsetting->desc.bInterfaceNumber > 0)
return -ENODEV; return -ENODEV;
data = kmalloc(sizeof(*data), GFP_KERNEL); data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data) { if (!data) {
BT_ERR("Can't allocate data structure"); BT_ERR("Can't allocate data structure");
return -ENOMEM; return -ENOMEM;
} }
memset(data, 0, sizeof(*data));
data->udev = udev; data->udev = udev;
rwlock_init(&data->lock); rwlock_init(&data->lock);
......
...@@ -671,10 +671,9 @@ static dev_link_t *bt3c_attach(void) ...@@ -671,10 +671,9 @@ static dev_link_t *bt3c_attach(void)
int ret; int ret;
/* Create new info device */ /* Create new info device */
info = kmalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) if (!info)
return NULL; return NULL;
memset(info, 0, sizeof(*info));
link = &info->link; link = &info->link;
link->priv = info; link->priv = info;
......
...@@ -590,10 +590,9 @@ static dev_link_t *btuart_attach(void) ...@@ -590,10 +590,9 @@ static dev_link_t *btuart_attach(void)
int ret; int ret;
/* Create new info device */ /* Create new info device */
info = kmalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) if (!info)
return NULL; return NULL;
memset(info, 0, sizeof(*info));
link = &info->link; link = &info->link;
link->priv = info; link->priv = info;
......
...@@ -569,10 +569,9 @@ static dev_link_t *dtl1_attach(void) ...@@ -569,10 +569,9 @@ static dev_link_t *dtl1_attach(void)
int ret; int ret;
/* Create new info device */ /* Create new info device */
info = kmalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) if (!info)
return NULL; return NULL;
memset(info, 0, sizeof(*info));
link = &info->link; link = &info->link;
link->priv = info; link->priv = info;
......
...@@ -715,10 +715,9 @@ static int bcsp_open(struct hci_uart *hu) ...@@ -715,10 +715,9 @@ static int bcsp_open(struct hci_uart *hu)
BT_DBG("hu %p", hu); BT_DBG("hu %p", hu);
bcsp = kmalloc(sizeof(*bcsp), GFP_ATOMIC); bcsp = kzalloc(sizeof(*bcsp), GFP_ATOMIC);
if (!bcsp) if (!bcsp)
return -ENOMEM; return -ENOMEM;
memset(bcsp, 0, sizeof(*bcsp));
hu->priv = bcsp; hu->priv = bcsp;
skb_queue_head_init(&bcsp->unack); skb_queue_head_init(&bcsp->unack);
......
...@@ -76,12 +76,10 @@ static int h4_open(struct hci_uart *hu) ...@@ -76,12 +76,10 @@ static int h4_open(struct hci_uart *hu)
BT_DBG("hu %p", hu); BT_DBG("hu %p", hu);
h4 = kmalloc(sizeof(*h4), GFP_ATOMIC); h4 = kzalloc(sizeof(*h4), GFP_ATOMIC);
if (!h4) if (!h4)
return -ENOMEM; return -ENOMEM;
memset(h4, 0, sizeof(*h4));
skb_queue_head_init(&h4->txq); skb_queue_head_init(&h4->txq);
hu->priv = h4; hu->priv = h4;
......
...@@ -272,13 +272,11 @@ static int hci_uart_tty_open(struct tty_struct *tty) ...@@ -272,13 +272,11 @@ static int hci_uart_tty_open(struct tty_struct *tty)
if (hu) if (hu)
return -EEXIST; 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"); BT_ERR("Can't allocate controll structure");
return -ENFILE; return -ENFILE;
} }
memset(hu, 0, sizeof(struct hci_uart));
tty->disc_data = hu; tty->disc_data = hu;
hu->tty = tty; hu->tty = tty;
......
...@@ -875,13 +875,11 @@ static int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id ...@@ -875,13 +875,11 @@ static int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id
goto done; 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"); BT_ERR("Can't allocate: control structure");
goto done; goto done;
} }
memset(husb, 0, sizeof(struct hci_usb));
husb->udev = udev; husb->udev = udev;
husb->bulk_out_ep = bulk_out_ep; husb->bulk_out_ep = bulk_out_ep;
husb->bulk_in_ep = bulk_in_ep; husb->bulk_in_ep = bulk_in_ep;
......
...@@ -261,12 +261,10 @@ static int vhci_open(struct inode *inode, struct file *file) ...@@ -261,12 +261,10 @@ static int vhci_open(struct inode *inode, struct file *file)
struct vhci_data *vhci; struct vhci_data *vhci;
struct hci_dev *hdev; struct hci_dev *hdev;
vhci = kmalloc(sizeof(struct vhci_data), GFP_KERNEL); vhci = kzalloc(sizeof(struct vhci_data), GFP_KERNEL);
if (!vhci) if (!vhci)
return -ENOMEM; return -ENOMEM;
memset(vhci, 0, sizeof(struct vhci_data));
skb_queue_head_init(&vhci->readq); skb_queue_head_init(&vhci->readq);
init_waitqueue_head(&vhci->read_wait); init_waitqueue_head(&vhci->read_wait);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment