Skip to content

Commit 5ada991

Browse files
David HerrmannGustavo F. Padovan
authored andcommitted
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: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
1 parent 42dceae commit 5ada991

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

  • net/bluetooth/rfcomm

‎net/bluetooth/rfcomm/tty.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,9 +1155,11 @@ static const struct tty_operations rfcomm_ops = {
11551155

11561156
int __init rfcomm_init_ttys(void)
11571157
{
1158+
int error;
1159+
11581160
rfcomm_tty_driver = alloc_tty_driver(RFCOMM_TTY_PORTS);
11591161
if (!rfcomm_tty_driver)
1160-
return -1;
1162+
return -ENOMEM;
11611163

11621164
rfcomm_tty_driver->owner = THIS_MODULE;
11631165
rfcomm_tty_driver->driver_name = "rfcomm";
@@ -1172,10 +1174,11 @@ int __init rfcomm_init_ttys(void)
11721174
rfcomm_tty_driver->init_termios.c_lflag &= ~ICANON;
11731175
tty_set_operations(rfcomm_tty_driver, &rfcomm_ops);
11741176

1175-
if (tty_register_driver(rfcomm_tty_driver)) {
1177+
error = tty_register_driver(rfcomm_tty_driver);
1178+
if (error) {
11761179
BT_ERR("Can't register RFCOMM TTY driver");
11771180
put_tty_driver(rfcomm_tty_driver);
1178-
return -1;
1181+
return error;
11791182
}
11801183

11811184
BT_INFO("RFCOMM TTY layer initialized");

0 commit comments

Comments
 (0)