Commit 05650694 authored by Vignesh Raman's avatar Vignesh Raman Committed by Marcel Holtmann

Bluetooth: Use single return in hci_uart_tty_ioctl() call

Remove multiple return statements in hci_uart_tty_ioctl() call and
added a single return statement.

This code re-organisation allows subsequent locking to be easily
added.
Signed-off-by: default avatarVignesh Raman <Vignesh_Raman@mentor.com>
Signed-off-by: default avatarDean Jenkins <Dean_Jenkins@mentor.com>
Signed-off-by: default avatarRajeev Kumar <rajeev_kumar@mentor.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 37332ddc
...@@ -697,34 +697,36 @@ static int hci_uart_tty_ioctl(struct tty_struct *tty, struct file *file, ...@@ -697,34 +697,36 @@ static int hci_uart_tty_ioctl(struct tty_struct *tty, struct file *file,
case HCIUARTSETPROTO: case HCIUARTSETPROTO:
if (!test_and_set_bit(HCI_UART_PROTO_SET, &hu->flags)) { if (!test_and_set_bit(HCI_UART_PROTO_SET, &hu->flags)) {
err = hci_uart_set_proto(hu, arg); err = hci_uart_set_proto(hu, arg);
if (err) { if (err)
clear_bit(HCI_UART_PROTO_SET, &hu->flags); clear_bit(HCI_UART_PROTO_SET, &hu->flags);
return err;
}
} else } else
return -EBUSY; err = -EBUSY;
break; break;
case HCIUARTGETPROTO: case HCIUARTGETPROTO:
if (test_bit(HCI_UART_PROTO_SET, &hu->flags)) if (test_bit(HCI_UART_PROTO_SET, &hu->flags))
return hu->proto->id; err = hu->proto->id;
return -EUNATCH; else
err = -EUNATCH;
break;
case HCIUARTGETDEVICE: case HCIUARTGETDEVICE:
if (test_bit(HCI_UART_REGISTERED, &hu->flags)) if (test_bit(HCI_UART_REGISTERED, &hu->flags))
return hu->hdev->id; err = hu->hdev->id;
return -EUNATCH; else
err = -EUNATCH;
break;
case HCIUARTSETFLAGS: case HCIUARTSETFLAGS:
if (test_bit(HCI_UART_PROTO_SET, &hu->flags)) if (test_bit(HCI_UART_PROTO_SET, &hu->flags))
return -EBUSY; err = -EBUSY;
err = hci_uart_set_flags(hu, arg); else
if (err) err = hci_uart_set_flags(hu, arg);
return err;
break; break;
case HCIUARTGETFLAGS: case HCIUARTGETFLAGS:
return hu->hdev_flags; err = hu->hdev_flags;
break;
default: default:
err = n_tty_ioctl_helper(tty, file, cmd, arg); err = n_tty_ioctl_helper(tty, file, cmd, arg);
......
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