Bluetooth: Cleanup RFCOMM device registration error handling
authorPeter Hurley <peter@hurleysoftware.com>
Mon, 10 Feb 2014 01:59:20 +0000 (20:59 -0500)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 14 Feb 2014 21:39:32 +0000 (13:39 -0800)
commitfb856e50900a84dd9f8d50d3882eb4a26ba6ea54
treeb04ea2e97ced0ca36862e776b779679e5546c9b3
parentf355095756c2a0b77a5b0aa0384c0c09d9735252
Bluetooth: Cleanup RFCOMM device registration error handling

If RFCOMM tty device registration fails, cleanup by releasing
the tty_port reference to trigger rfcomm_dev destruction
(rather than open-coding it).

The dlc reference release is moved into rfcomm_dev_add(),
which ensures cleanup in both error paths -- ie., if
__rfcomm_dev_add() fails or if tty_port_register_device() fails.

Fixes releasing the module reference if device registration fails.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Tested-By: Alexander Holler <holler@ahsoftware.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/rfcomm/tty.c