Bluetooth: Enforce providing hdev->send driver callback
authorMarcel Holtmann <marcel@holtmann.org>
Sun, 6 Jul 2014 13:50:27 +0000 (15:50 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Sun, 6 Jul 2014 14:11:37 +0000 (17:11 +0300)
The hdev->send driver callback is mandatory to be provided by a driver
before calling hci_register_dev. So enforce it and return EINVAL in
case it is not available.

All existing drivers are providing this callback anyway, so this is
just an extra sanity check.

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

index b02454ab07ee28ada43db7cf1c3e675b3ca3113a..623ffe0da4a63788bc0984e264426a7e1961ae57 100644 (file)
@@ -3932,7 +3932,7 @@ int hci_register_dev(struct hci_dev *hdev)
 {
        int id, error;
 
-       if (!hdev->open || !hdev->close)
+       if (!hdev->open || !hdev->close || !hdev->send)
                return -EINVAL;
 
        /* Do not allow HCI_AMP devices to register at index 0,