[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <7783b5bb10aa8d6adbbbad31e0030ac3e788c0a8.1549346039.git.mhjungk@gmail.com>
Date: Mon, 4 Feb 2019 22:41:41 -0800
From: Myungho Jung <mhjungk@...il.com>
To: marcel@...tmann.org
Cc: johan.hedberg@...il.com, linux-bluetooth@...r.kernel.org,
linux-kernel@...r.kernel.org, Myungho Jung <mhjungk@...il.com>,
stable@...r.kernel.org
Subject: [PATCH v3 1/2] Bluetooth: hci_ath: Add NULL check for tiocmget() and tiocmset() in ath_setup()
tiocmget() and tiocmset() operations are optional so they are not
guaranteed to be set. Return ENODEV in ath_setup() if tty driver doesn't
support the operations.
Fixes: 4c876c0edbdc ("hci_uart: Add Atheros support for address config")
Cc: <stable@...r.kernel.org> # 4.1
Signed-off-by: Myungho Jung <mhjungk@...il.com>
---
Changes in v2:
- Add NULL check and return error in ath_setup() instead of
ath_hci_uart_work()
Changes in v3:
- Fix to return -ENODEV
- Split into 2 patches
- Add stable CC and fixes tags
drivers/bluetooth/hci_ath.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/bluetooth/hci_ath.c b/drivers/bluetooth/hci_ath.c
index d568fbd94d6c..9f1ac1805d23 100644
--- a/drivers/bluetooth/hci_ath.c
+++ b/drivers/bluetooth/hci_ath.c
@@ -185,8 +185,14 @@ static int ath_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
static int ath_setup(struct hci_uart *hu)
{
+ struct tty_struct *tty = hu->tty;
+
BT_DBG("hu %p", hu);
+ /* tty driver should support operations to set RTS */
+ if (!tty->driver->ops->tiocmget || !tty->driver->ops->tiocmset)
+ return -ENODEV;
+
hu->hdev->set_bdaddr = ath_set_bdaddr;
return 0;
--
2.17.1
Powered by blists - more mailing lists