diff options
Diffstat (limited to 'drivers/bluetooth/hci_ldisc.c')
-rw-r--r-- | drivers/bluetooth/hci_ldisc.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 613673b12fa6..420b645c4c9f 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -23,7 +23,6 @@ | |||
23 | * | 23 | * |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/config.h> | ||
27 | #include <linux/module.h> | 26 | #include <linux/module.h> |
28 | 27 | ||
29 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
@@ -192,7 +191,7 @@ static int hci_uart_flush(struct hci_dev *hdev) | |||
192 | 191 | ||
193 | /* Flush any pending characters in the driver and discipline. */ | 192 | /* Flush any pending characters in the driver and discipline. */ |
194 | tty_ldisc_flush(tty); | 193 | tty_ldisc_flush(tty); |
195 | if (tty->driver->flush_buffer) | 194 | if (tty->driver && tty->driver->flush_buffer) |
196 | tty->driver->flush_buffer(tty); | 195 | tty->driver->flush_buffer(tty); |
197 | 196 | ||
198 | if (test_bit(HCI_UART_PROTO_SET, &hu->flags)) | 197 | if (test_bit(HCI_UART_PROTO_SET, &hu->flags)) |
@@ -242,15 +241,11 @@ static int hci_uart_send_frame(struct sk_buff *skb) | |||
242 | 241 | ||
243 | static void hci_uart_destruct(struct hci_dev *hdev) | 242 | static void hci_uart_destruct(struct hci_dev *hdev) |
244 | { | 243 | { |
245 | struct hci_uart *hu; | ||
246 | |||
247 | if (!hdev) | 244 | if (!hdev) |
248 | return; | 245 | return; |
249 | 246 | ||
250 | BT_DBG("%s", hdev->name); | 247 | BT_DBG("%s", hdev->name); |
251 | 248 | kfree(hdev->driver_data); | |
252 | hu = (struct hci_uart *) hdev->driver_data; | ||
253 | kfree(hu); | ||
254 | } | 249 | } |
255 | 250 | ||
256 | /* ------ LDISC part ------ */ | 251 | /* ------ LDISC part ------ */ |
@@ -273,7 +268,7 @@ static int hci_uart_tty_open(struct tty_struct *tty) | |||
273 | return -EEXIST; | 268 | return -EEXIST; |
274 | 269 | ||
275 | if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) { | 270 | if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) { |
276 | BT_ERR("Can't allocate controll structure"); | 271 | BT_ERR("Can't allocate control structure"); |
277 | return -ENFILE; | 272 | return -ENFILE; |
278 | } | 273 | } |
279 | 274 | ||
@@ -291,7 +286,7 @@ static int hci_uart_tty_open(struct tty_struct *tty) | |||
291 | if (tty->ldisc.flush_buffer) | 286 | if (tty->ldisc.flush_buffer) |
292 | tty->ldisc.flush_buffer(tty); | 287 | tty->ldisc.flush_buffer(tty); |
293 | 288 | ||
294 | if (tty->driver->flush_buffer) | 289 | if (tty->driver && tty->driver->flush_buffer) |
295 | tty->driver->flush_buffer(tty); | 290 | tty->driver->flush_buffer(tty); |
296 | 291 | ||
297 | return 0; | 292 | return 0; |
@@ -361,7 +356,7 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty) | |||
361 | * | 356 | * |
362 | * Return Value: None | 357 | * Return Value: None |
363 | */ | 358 | */ |
364 | static void hci_uart_tty_receive(struct tty_struct *tty, const __u8 *data, char *flags, int count) | 359 | static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data, char *flags, int count) |
365 | { | 360 | { |
366 | struct hci_uart *hu = (void *)tty->disc_data; | 361 | struct hci_uart *hu = (void *)tty->disc_data; |
367 | 362 | ||
@@ -376,7 +371,8 @@ static void hci_uart_tty_receive(struct tty_struct *tty, const __u8 *data, char | |||
376 | hu->hdev->stat.byte_rx += count; | 371 | hu->hdev->stat.byte_rx += count; |
377 | spin_unlock(&hu->rx_lock); | 372 | spin_unlock(&hu->rx_lock); |
378 | 373 | ||
379 | if (test_and_clear_bit(TTY_THROTTLED,&tty->flags) && tty->driver->unthrottle) | 374 | if (test_and_clear_bit(TTY_THROTTLED, &tty->flags) && |
375 | tty->driver->unthrottle) | ||
380 | tty->driver->unthrottle(tty); | 376 | tty->driver->unthrottle(tty); |
381 | } | 377 | } |
382 | 378 | ||