Skip to contentSkip to conversation

Bluetooth: Enforce providing hdev->send driver callback

PATCH Applied Marcel Holtmann 2 participants 2 messages Jul 6, 2014

Subsystems (2)
lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: Enforce providing hdev->send driver callback

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.

---
 net/bluetooth/hci_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hci_core.c +1 -1
index b02454ab07ee..623ffe0da4a6 100644
@@ -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,
Signature · 1 line
1.9.3
#1 lore raw

Hi Marcel,

Quoted 11 lines · Marcel Holtmann

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.

---
 net/bluetooth/hci_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to bluetooth-next. Thanks.

Johan