]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
Bluetooth: mgmt: Check for HCI_UP in update_eir() and update_class()
authorJohan Hedberg <johan.hedberg@intel.com>
Wed, 22 Feb 2012 20:06:38 +0000 (22:06 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Thu, 23 Feb 2012 11:07:01 +0000 (13:07 +0200)
These functions should just silently fail when we're not powered on
instead of trying to send HCI commands.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/mgmt.c

index 23421f05abf2766e121b97aa26653173e5dc40b2..3a2066504ffec2815641196fdcdab2a7c4647036 100644 (file)
@@ -532,6 +532,9 @@ static int update_eir(struct hci_dev *hdev)
 {
        struct hci_cp_write_eir cp;
 
+       if (!test_bit(HCI_UP, &hdev->flags))
+               return 0;
+
        if (!(hdev->features[6] & LMP_EXT_INQ))
                return 0;
 
@@ -570,6 +573,9 @@ static int update_class(struct hci_dev *hdev)
 
        BT_DBG("%s", hdev->name);
 
+       if (!test_bit(HCI_UP, &hdev->flags))
+               return 0;
+
        if (test_bit(HCI_SERVICE_CACHE, &hdev->dev_flags))
                return 0;