aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/rfcomm/tty.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2011-10-24 09:30:57 -0400
committerGustavo F. Padovan <padovan@profusion.mobi>2011-11-07 14:24:39 -0500
commit5ada9913630d48438f2e07551af43cbf297372d4 (patch)
treee8868bb9659794c935fa9d4bb85a0ea52a4b5e3b /net/bluetooth/rfcomm/tty.c
parent42dceae2819b5ac6fc9a0d414ae05a8960e2a1d9 (diff)
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>
Diffstat (limited to 'net/bluetooth/rfcomm/tty.c')
-rw-r--r--net/bluetooth/rfcomm/tty.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index c258796313e0..2b753a3f4d61 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -1155,9 +1155,11 @@ static const struct tty_operations rfcomm_ops = {
1155 1155
1156int __init rfcomm_init_ttys(void) 1156int __init rfcomm_init_ttys(void)
1157{ 1157{
1158 int error;
1159
1158 rfcomm_tty_driver = alloc_tty_driver(RFCOMM_TTY_PORTS); 1160 rfcomm_tty_driver = alloc_tty_driver(RFCOMM_TTY_PORTS);
1159 if (!rfcomm_tty_driver) 1161 if (!rfcomm_tty_driver)
1160 return -1; 1162 return -ENOMEM;
1161 1163
1162 rfcomm_tty_driver->owner = THIS_MODULE; 1164 rfcomm_tty_driver->owner = THIS_MODULE;
1163 rfcomm_tty_driver->driver_name = "rfcomm"; 1165 rfcomm_tty_driver->driver_name = "rfcomm";
@@ -1172,10 +1174,11 @@ int __init rfcomm_init_ttys(void)
1172 rfcomm_tty_driver->init_termios.c_lflag &= ~ICANON; 1174 rfcomm_tty_driver->init_termios.c_lflag &= ~ICANON;
1173 tty_set_operations(rfcomm_tty_driver, &rfcomm_ops); 1175 tty_set_operations(rfcomm_tty_driver, &rfcomm_ops);
1174 1176
1175 if (tty_register_driver(rfcomm_tty_driver)) { 1177 error = tty_register_driver(rfcomm_tty_driver);
1178 if (error) {
1176 BT_ERR("Can't register RFCOMM TTY driver"); 1179 BT_ERR("Can't register RFCOMM TTY driver");
1177 put_tty_driver(rfcomm_tty_driver); 1180 put_tty_driver(rfcomm_tty_driver);
1178 return -1; 1181 return error;
1179 } 1182 }
1180 1183
1181 BT_INFO("RFCOMM TTY layer initialized"); 1184 BT_INFO("RFCOMM TTY layer initialized");