Commit 5a0b8159 authored by David Herrmann's avatar David Herrmann Committed by Johan Hedberg

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: default avatarDavid Herrmann <dh.herrmann@googlemail.com>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent f5fd5bae
...@@ -83,9 +83,6 @@ typedef struct dtl1_info_t { ...@@ -83,9 +83,6 @@ typedef struct dtl1_info_t {
static int dtl1_config(struct pcmcia_device *link); static int dtl1_config(struct pcmcia_device *link);
static void dtl1_release(struct pcmcia_device *link);
static void dtl1_detach(struct pcmcia_device *p_dev);
/* Transmit states */ /* Transmit states */
...@@ -579,8 +576,8 @@ static void dtl1_detach(struct pcmcia_device *link) ...@@ -579,8 +576,8 @@ static void dtl1_detach(struct pcmcia_device *link)
{ {
dtl1_info_t *info = link->priv; dtl1_info_t *info = link->priv;
dtl1_release(link); dtl1_close(info);
pcmcia_disable_device(link);
kfree(info); kfree(info);
} }
...@@ -619,21 +616,10 @@ static int dtl1_config(struct pcmcia_device *link) ...@@ -619,21 +616,10 @@ static int dtl1_config(struct pcmcia_device *link)
return 0; return 0;
failed: failed:
dtl1_release(link); dtl1_detach(link);
return -ENODEV; return -ENODEV;
} }
static void dtl1_release(struct pcmcia_device *link)
{
dtl1_info_t *info = link->priv;
dtl1_close(info);
pcmcia_disable_device(link);
}
static const struct pcmcia_device_id dtl1_ids[] = { static const struct pcmcia_device_id dtl1_ids[] = {
PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-1", 0xe1bfdd64, 0xe168480d), PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-1", 0xe1bfdd64, 0xe168480d),
PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-4", 0xe1bfdd64, 0x9102bc82), PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-4", 0xe1bfdd64, 0x9102bc82),
......
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