summaryrefslogtreecommitdiff
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2015-10-04 23:34:01 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2015-10-05 10:30:10 +0300
commit73d0d3c8671190ea982a8e79a7c79fbfe88f8f47 (patch)
tree5a994705148d72200a441ca53e53694c2810b993 /net/bluetooth/hci_core.c
parent4a3f95b7b62e50a1e42e42ba6571ec9e747f4861 (diff)
Bluetooth: Move HCI_RUNNING check into hci_send_frame
In all callbacks for hdev->send the status of HCI_RUNNING is checked. So instead of repeating that code in every driver, move the check into the hci_send_frame function before calling hdev->send. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 5af33c87cbba..b955f7192651 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3536,6 +3536,11 @@ static void hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
/* Get rid of skb owner, prior to sending to the driver. */
skb_orphan(skb);
+ if (!test_bit(HCI_RUNNING, &hdev->flags)) {
+ kfree_skb(skb);
+ return;
+ }
+
err = hdev->send(hdev, skb);
if (err < 0) {
BT_ERR("%s sending frame failed (%d)", hdev->name, err);