diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-07-16 09:12:10 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-07-17 13:48:27 -0400 |
commit | dac670b97698f7c5584b224dd68d9d612b9ad4d7 (patch) | |
tree | 3eb335512bb97afd17579a014829f7db0c210b48 /drivers/bluetooth/hci_ldisc.c | |
parent | 40f10224df6f00b59ab342e3d9d9ac8b50c8eada (diff) |
Bluetooth: Simplify hci_uart_tty_close logic
This patch cleans up and reduces indentation in the hci_uart_tty_close
function.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'drivers/bluetooth/hci_ldisc.c')
-rw-r--r-- | drivers/bluetooth/hci_ldisc.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 142f49cde848..b6d1f200401a 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -286,28 +286,29 @@ static int hci_uart_tty_open(struct tty_struct *tty) | |||
286 | static void hci_uart_tty_close(struct tty_struct *tty) | 286 | static void hci_uart_tty_close(struct tty_struct *tty) |
287 | { | 287 | { |
288 | struct hci_uart *hu = (void *)tty->disc_data; | 288 | struct hci_uart *hu = (void *)tty->disc_data; |
289 | struct hci_dev *hdev; | ||
289 | 290 | ||
290 | BT_DBG("tty %p", tty); | 291 | BT_DBG("tty %p", tty); |
291 | 292 | ||
292 | /* Detach from the tty */ | 293 | /* Detach from the tty */ |
293 | tty->disc_data = NULL; | 294 | tty->disc_data = NULL; |
294 | 295 | ||
295 | if (hu) { | 296 | if (!hu) |
296 | struct hci_dev *hdev = hu->hdev; | 297 | return; |
297 | 298 | ||
298 | if (hdev) | 299 | hdev = hu->hdev; |
299 | hci_uart_close(hdev); | 300 | if (hdev) |
301 | hci_uart_close(hdev); | ||
300 | 302 | ||
301 | if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { | 303 | if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { |
302 | if (hdev) { | 304 | if (hdev) { |
303 | hci_unregister_dev(hdev); | 305 | hci_unregister_dev(hdev); |
304 | hci_free_dev(hdev); | 306 | hci_free_dev(hdev); |
305 | } | ||
306 | hu->proto->close(hu); | ||
307 | } | 307 | } |
308 | 308 | hu->proto->close(hu); | |
309 | kfree(hu); | ||
310 | } | 309 | } |
310 | |||
311 | kfree(hu); | ||
311 | } | 312 | } |
312 | 313 | ||
313 | /* hci_uart_tty_wakeup() | 314 | /* hci_uart_tty_wakeup() |