aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-01-07 09:19:41 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-13 10:01:22 -0500
commit5a0b8159e1c65ce25382d3f5189b6a462422f065 (patch)
treec981287a0ab7c5f9920ff6b8d3ebf0442232f05f /drivers/bluetooth
parentf5fd5baee39fe941bd73973c63990d153184e3a1 (diff)
Bluetooth: dtl1: Fix memleak in probe()
We currently leak the driver info structure if dtl1_config fails. If we add a kfree() to dtl1_release to fix this, then dtl1_release and dtl1_detach are identical so this merges both functions. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/dtl1_cs.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index 969bb22e493f..b2db5e9bd1fd 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -83,9 +83,6 @@ typedef struct dtl1_info_t {
83 83
84 84
85static int dtl1_config(struct pcmcia_device *link); 85static int dtl1_config(struct pcmcia_device *link);
86static void dtl1_release(struct pcmcia_device *link);
87
88static void dtl1_detach(struct pcmcia_device *p_dev);
89 86
90 87
91/* Transmit states */ 88/* Transmit states */
@@ -579,8 +576,8 @@ static void dtl1_detach(struct pcmcia_device *link)
579{ 576{
580 dtl1_info_t *info = link->priv; 577 dtl1_info_t *info = link->priv;
581 578
582 dtl1_release(link); 579 dtl1_close(info);
583 580 pcmcia_disable_device(link);
584 kfree(info); 581 kfree(info);
585} 582}
586 583
@@ -619,21 +616,10 @@ static int dtl1_config(struct pcmcia_device *link)
619 return 0; 616 return 0;
620 617
621failed: 618failed:
622 dtl1_release(link); 619 dtl1_detach(link);
623 return -ENODEV; 620 return -ENODEV;
624} 621}
625 622
626
627static void dtl1_release(struct pcmcia_device *link)
628{
629 dtl1_info_t *info = link->priv;
630
631 dtl1_close(info);
632
633 pcmcia_disable_device(link);
634}
635
636
637static const struct pcmcia_device_id dtl1_ids[] = { 623static const struct pcmcia_device_id dtl1_ids[] = {
638 PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-1", 0xe1bfdd64, 0xe168480d), 624 PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-1", 0xe1bfdd64, 0xe168480d),
639 PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-4", 0xe1bfdd64, 0x9102bc82), 625 PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-4", 0xe1bfdd64, 0x9102bc82),