Commit 5ada9913 authored by David Herrmann's avatar David Herrmann Committed by Gustavo F. Padovan

Bluetooth: Return proper error codes on rfcomm tty init

Forward error codes from tty core to the rfcomm_init caller instead of using
generic -1 errors.
Signed-off-by: default avatarDavid Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent 42dceae2
...@@ -1155,9 +1155,11 @@ static const struct tty_operations rfcomm_ops = { ...@@ -1155,9 +1155,11 @@ static const struct tty_operations rfcomm_ops = {
int __init rfcomm_init_ttys(void) int __init rfcomm_init_ttys(void)
{ {
int error;
rfcomm_tty_driver = alloc_tty_driver(RFCOMM_TTY_PORTS); rfcomm_tty_driver = alloc_tty_driver(RFCOMM_TTY_PORTS);
if (!rfcomm_tty_driver) if (!rfcomm_tty_driver)
return -1; return -ENOMEM;
rfcomm_tty_driver->owner = THIS_MODULE; rfcomm_tty_driver->owner = THIS_MODULE;
rfcomm_tty_driver->driver_name = "rfcomm"; rfcomm_tty_driver->driver_name = "rfcomm";
...@@ -1172,10 +1174,11 @@ int __init rfcomm_init_ttys(void) ...@@ -1172,10 +1174,11 @@ int __init rfcomm_init_ttys(void)
rfcomm_tty_driver->init_termios.c_lflag &= ~ICANON; rfcomm_tty_driver->init_termios.c_lflag &= ~ICANON;
tty_set_operations(rfcomm_tty_driver, &rfcomm_ops); tty_set_operations(rfcomm_tty_driver, &rfcomm_ops);
if (tty_register_driver(rfcomm_tty_driver)) { error = tty_register_driver(rfcomm_tty_driver);
if (error) {
BT_ERR("Can't register RFCOMM TTY driver"); BT_ERR("Can't register RFCOMM TTY driver");
put_tty_driver(rfcomm_tty_driver); put_tty_driver(rfcomm_tty_driver);
return -1; return error;
} }
BT_INFO("RFCOMM TTY layer initialized"); BT_INFO("RFCOMM TTY layer initialized");
......
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