Skip to content

Commit

Permalink
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/bluetooth/bluetooth-next
  • Loading branch information
John W. Linville committed Aug 10, 2012
2 parents b877f4c + cd17dec commit 57f784f
Show file tree
Hide file tree
Showing 29 changed files with 415 additions and 197 deletions.
8 changes: 1 addition & 7 deletions drivers/bluetooth/bcm203x.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id
if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
return -ENODEV;

data = kzalloc(sizeof(*data), GFP_KERNEL);
data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
if (!data) {
BT_ERR("Can't allocate memory for data structure");
return -ENOMEM;
Expand All @@ -189,14 +189,12 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id
data->urb = usb_alloc_urb(0, GFP_KERNEL);
if (!data->urb) {
BT_ERR("Can't allocate URB");
kfree(data);
return -ENOMEM;
}

if (request_firmware(&firmware, "BCM2033-MD.hex", &udev->dev) < 0) {
BT_ERR("Mini driver request failed");
usb_free_urb(data->urb);
kfree(data);
return -EIO;
}

Expand All @@ -209,7 +207,6 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id
BT_ERR("Can't allocate memory for mini driver");
release_firmware(firmware);
usb_free_urb(data->urb);
kfree(data);
return -ENOMEM;
}

Expand All @@ -224,7 +221,6 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id
BT_ERR("Firmware request failed");
usb_free_urb(data->urb);
kfree(data->buffer);
kfree(data);
return -EIO;
}

Expand All @@ -236,7 +232,6 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id
release_firmware(firmware);
usb_free_urb(data->urb);
kfree(data->buffer);
kfree(data);
return -ENOMEM;
}

Expand Down Expand Up @@ -271,7 +266,6 @@ static void bcm203x_disconnect(struct usb_interface *intf)
usb_free_urb(data->urb);
kfree(data->fw_data);
kfree(data->buffer);
kfree(data);
}

static struct usb_driver bcm203x_driver = {
Expand Down
12 changes: 4 additions & 8 deletions drivers/bluetooth/bfusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
}

/* Initialize control structure and load firmware */
data = kzalloc(sizeof(struct bfusb_data), GFP_KERNEL);
data = devm_kzalloc(&intf->dev, sizeof(struct bfusb_data), GFP_KERNEL);
if (!data) {
BT_ERR("Can't allocate memory for control structure");
goto done;
Expand All @@ -674,7 +674,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i

if (request_firmware(&firmware, "bfubase.frm", &udev->dev) < 0) {
BT_ERR("Firmware request failed");
goto error;
goto done;
}

BT_DBG("firmware data %p size %zu", firmware->data, firmware->size);
Expand All @@ -690,7 +690,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
hdev = hci_alloc_dev();
if (!hdev) {
BT_ERR("Can't allocate HCI device");
goto error;
goto done;
}

data->hdev = hdev;
Expand All @@ -708,7 +708,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
if (hci_register_dev(hdev) < 0) {
BT_ERR("Can't register HCI device");
hci_free_dev(hdev);
goto error;
goto done;
}

usb_set_intfdata(intf, data);
Expand All @@ -718,9 +718,6 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
release:
release_firmware(firmware);

error:
kfree(data);

done:
return -EIO;
}
Expand All @@ -741,7 +738,6 @@ static void bfusb_disconnect(struct usb_interface *intf)

hci_unregister_dev(hdev);
hci_free_dev(hdev);
kfree(data);
}

static struct usb_driver bfusb_driver = {
Expand Down
5 changes: 1 addition & 4 deletions drivers/bluetooth/bluecard_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ static int bluecard_probe(struct pcmcia_device *link)
bluecard_info_t *info;

/* Create new info device */
info = kzalloc(sizeof(*info), GFP_KERNEL);
info = devm_kzalloc(&link->dev, sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;

Expand All @@ -864,10 +864,7 @@ static int bluecard_probe(struct pcmcia_device *link)

static void bluecard_detach(struct pcmcia_device *link)
{
bluecard_info_t *info = link->priv;

bluecard_release(link);
kfree(info);
}


Expand Down
8 changes: 2 additions & 6 deletions drivers/bluetooth/bpa10x.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id *
if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
return -ENODEV;

data = kzalloc(sizeof(*data), GFP_KERNEL);
data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;

Expand All @@ -453,10 +453,8 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id *
init_usb_anchor(&data->rx_anchor);

hdev = hci_alloc_dev();
if (!hdev) {
kfree(data);
if (!hdev)
return -ENOMEM;
}

hdev->bus = HCI_USB;
hci_set_drvdata(hdev, data);
Expand All @@ -475,7 +473,6 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id *
err = hci_register_dev(hdev);
if (err < 0) {
hci_free_dev(hdev);
kfree(data);
return err;
}

Expand All @@ -500,7 +497,6 @@ static void bpa10x_disconnect(struct usb_interface *intf)
hci_free_dev(data->hdev);
kfree_skb(data->rx_skb[0]);
kfree_skb(data->rx_skb[1]);
kfree(data);
}

static struct usb_driver bpa10x_driver = {
Expand Down
5 changes: 1 addition & 4 deletions drivers/bluetooth/bt3c_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ static int bt3c_probe(struct pcmcia_device *link)
bt3c_info_t *info;

/* Create new info device */
info = kzalloc(sizeof(*info), GFP_KERNEL);
info = devm_kzalloc(&link->dev, sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;

Expand All @@ -654,10 +654,7 @@ static int bt3c_probe(struct pcmcia_device *link)

static void bt3c_detach(struct pcmcia_device *link)
{
bt3c_info_t *info = link->priv;

bt3c_release(link);
kfree(info);
}

static int bt3c_check_config(struct pcmcia_device *p_dev, void *priv_data)
Expand Down
15 changes: 4 additions & 11 deletions drivers/bluetooth/btmrvl_sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -956,11 +956,9 @@ static int btmrvl_sdio_probe(struct sdio_func *func,
BT_INFO("vendor=0x%x, device=0x%x, class=%d, fn=%d",
id->vendor, id->device, id->class, func->num);

card = kzalloc(sizeof(*card), GFP_KERNEL);
if (!card) {
ret = -ENOMEM;
goto done;
}
card = devm_kzalloc(&func->dev, sizeof(*card), GFP_KERNEL);
if (!card)
return -ENOMEM;

card->func = func;

Expand All @@ -974,8 +972,7 @@ static int btmrvl_sdio_probe(struct sdio_func *func,

if (btmrvl_sdio_register_dev(card) < 0) {
BT_ERR("Failed to register BT device!");
ret = -ENODEV;
goto free_card;
return -ENODEV;
}

/* Disable the interrupts on the card */
Expand Down Expand Up @@ -1023,9 +1020,6 @@ static int btmrvl_sdio_probe(struct sdio_func *func,
btmrvl_sdio_disable_host_int(card);
unreg_dev:
btmrvl_sdio_unregister_dev(card);
free_card:
kfree(card);
done:
return ret;
}

Expand All @@ -1047,7 +1041,6 @@ static void btmrvl_sdio_remove(struct sdio_func *func)
BT_DBG("unregester dev");
btmrvl_sdio_unregister_dev(card);
btmrvl_remove_card(card->priv);
kfree(card);
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions drivers/bluetooth/btsdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ static int btsdio_probe(struct sdio_func *func,
tuple = tuple->next;
}

data = kzalloc(sizeof(*data), GFP_KERNEL);
data = devm_kzalloc(&func->dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;

Expand All @@ -315,10 +315,8 @@ static int btsdio_probe(struct sdio_func *func,
skb_queue_head_init(&data->txq);

hdev = hci_alloc_dev();
if (!hdev) {
kfree(data);
if (!hdev)
return -ENOMEM;
}

hdev->bus = HCI_SDIO;
hci_set_drvdata(hdev, data);
Expand All @@ -340,7 +338,6 @@ static int btsdio_probe(struct sdio_func *func,
err = hci_register_dev(hdev);
if (err < 0) {
hci_free_dev(hdev);
kfree(data);
return err;
}

Expand All @@ -366,7 +363,6 @@ static void btsdio_remove(struct sdio_func *func)
hci_unregister_dev(hdev);

hci_free_dev(hdev);
kfree(data);
}

static struct sdio_driver btsdio_driver = {
Expand Down
5 changes: 1 addition & 4 deletions drivers/bluetooth/btuart_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ static int btuart_probe(struct pcmcia_device *link)
btuart_info_t *info;

/* Create new info device */
info = kzalloc(sizeof(*info), GFP_KERNEL);
info = devm_kzalloc(&link->dev, sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;

Expand All @@ -583,10 +583,7 @@ static int btuart_probe(struct pcmcia_device *link)

static void btuart_detach(struct pcmcia_device *link)
{
btuart_info_t *info = link->priv;

btuart_release(link);
kfree(info);
}

static int btuart_check_config(struct pcmcia_device *p_dev, void *priv_data)
Expand Down
13 changes: 3 additions & 10 deletions drivers/bluetooth/btusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ static int btusb_probe(struct usb_interface *intf,
return -ENODEV;
}

data = kzalloc(sizeof(*data), GFP_KERNEL);
data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;

Expand All @@ -975,10 +975,8 @@ static int btusb_probe(struct usb_interface *intf,
}
}

if (!data->intr_ep || !data->bulk_tx_ep || !data->bulk_rx_ep) {
kfree(data);
if (!data->intr_ep || !data->bulk_tx_ep || !data->bulk_rx_ep)
return -ENODEV;
}

data->cmdreq_type = USB_TYPE_CLASS;

Expand All @@ -998,10 +996,8 @@ static int btusb_probe(struct usb_interface *intf,
init_usb_anchor(&data->deferred);

hdev = hci_alloc_dev();
if (!hdev) {
kfree(data);
if (!hdev)
return -ENOMEM;
}

hdev->bus = HCI_USB;
hci_set_drvdata(hdev, data);
Expand Down Expand Up @@ -1069,15 +1065,13 @@ static int btusb_probe(struct usb_interface *intf,
data->isoc, data);
if (err < 0) {
hci_free_dev(hdev);
kfree(data);
return err;
}
}

err = hci_register_dev(hdev);
if (err < 0) {
hci_free_dev(hdev);
kfree(data);
return err;
}

Expand Down Expand Up @@ -1110,7 +1104,6 @@ static void btusb_disconnect(struct usb_interface *intf)
usb_driver_release_interface(&btusb_driver, data->isoc);

hci_free_dev(hdev);
kfree(data);
}

#ifdef CONFIG_PM
Expand Down
8 changes: 2 additions & 6 deletions drivers/bluetooth/btwilink.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,16 +297,14 @@ static int bt_ti_probe(struct platform_device *pdev)
struct hci_dev *hdev;
int err;

hst = kzalloc(sizeof(struct ti_st), GFP_KERNEL);
hst = devm_kzalloc(&pdev->dev, sizeof(struct ti_st), GFP_KERNEL);
if (!hst)
return -ENOMEM;

/* Expose "hciX" device to user space */
hdev = hci_alloc_dev();
if (!hdev) {
kfree(hst);
if (!hdev)
return -ENOMEM;
}

BT_DBG("hdev %p", hdev);

Expand All @@ -321,7 +319,6 @@ static int bt_ti_probe(struct platform_device *pdev)
err = hci_register_dev(hdev);
if (err < 0) {
BT_ERR("Can't register HCI device error %d", err);
kfree(hst);
hci_free_dev(hdev);
return err;
}
Expand All @@ -347,7 +344,6 @@ static int bt_ti_remove(struct platform_device *pdev)
hci_unregister_dev(hdev);

hci_free_dev(hdev);
kfree(hst);

dev_set_drvdata(&pdev->dev, NULL);
return 0;
Expand Down
3 changes: 1 addition & 2 deletions drivers/bluetooth/dtl1_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ static int dtl1_probe(struct pcmcia_device *link)
dtl1_info_t *info;

/* Create new info device */
info = kzalloc(sizeof(*info), GFP_KERNEL);
info = devm_kzalloc(&link->dev, sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;

Expand All @@ -569,7 +569,6 @@ static void dtl1_detach(struct pcmcia_device *link)

dtl1_close(info);
pcmcia_disable_device(link);
kfree(info);
}

static int dtl1_confcheck(struct pcmcia_device *p_dev, void *priv_data)
Expand Down
Loading

0 comments on commit 57f784f

Please sign in to comment.