Commit dac670b9 authored by Johan Hedberg's avatar Johan Hedberg Committed by Gustavo Padovan

Bluetooth: Simplify hci_uart_tty_close logic

This patch cleans up and reduces indentation in the hci_uart_tty_close
function.
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
parent 40f10224
...@@ -286,28 +286,29 @@ static int hci_uart_tty_open(struct tty_struct *tty) ...@@ -286,28 +286,29 @@ static int hci_uart_tty_open(struct tty_struct *tty)
static void hci_uart_tty_close(struct tty_struct *tty) static void hci_uart_tty_close(struct tty_struct *tty)
{ {
struct hci_uart *hu = (void *)tty->disc_data; struct hci_uart *hu = (void *)tty->disc_data;
struct hci_dev *hdev;
BT_DBG("tty %p", tty); BT_DBG("tty %p", tty);
/* Detach from the tty */ /* Detach from the tty */
tty->disc_data = NULL; tty->disc_data = NULL;
if (hu) { if (!hu)
struct hci_dev *hdev = hu->hdev; return;
if (hdev) hdev = hu->hdev;
hci_uart_close(hdev); if (hdev)
hci_uart_close(hdev);
if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) {
if (hdev) { if (hdev) {
hci_unregister_dev(hdev); hci_unregister_dev(hdev);
hci_free_dev(hdev); hci_free_dev(hdev);
}
hu->proto->close(hu);
} }
hu->proto->close(hu);
kfree(hu);
} }
kfree(hu);
} }
/* hci_uart_tty_wakeup() /* hci_uart_tty_wakeup()
......
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