Skip to content

Commit

Permalink
Bluetooth: Return proper error codes on rfcomm tty init
Browse files Browse the repository at this point in the history
Forward error codes from tty core to the rfcomm_init caller instead of using
generic -1 errors.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
  • Loading branch information
David Herrmann authored and Gustavo F. Padovan committed Nov 7, 2011
1 parent 42dceae commit 5ada991
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions net/bluetooth/rfcomm/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -1155,9 +1155,11 @@ static const struct tty_operations rfcomm_ops = {

int __init rfcomm_init_ttys(void)
{
int error;

rfcomm_tty_driver = alloc_tty_driver(RFCOMM_TTY_PORTS);
if (!rfcomm_tty_driver)
return -1;
return -ENOMEM;

rfcomm_tty_driver->owner = THIS_MODULE;
rfcomm_tty_driver->driver_name = "rfcomm";
Expand All @@ -1172,10 +1174,11 @@ int __init rfcomm_init_ttys(void)
rfcomm_tty_driver->init_termios.c_lflag &= ~ICANON;
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");
put_tty_driver(rfcomm_tty_driver);
return -1;
return error;
}

BT_INFO("RFCOMM TTY layer initialized");
Expand Down

0 comments on commit 5ada991

Please sign in to comment.