From 0356d1403d87ed6de12f39a6643d0b2513b3f808 Mon Sep 17 00:00:00 2001 From: Lwazi Dube Date: Wed, 26 Apr 2023 16:28:13 -0400 Subject: [PATCH] wireless/bluetooth: Initialize private bt_driver_s member. --- include/nuttx/wireless/bluetooth/bt_driver.h | 10 +++++++++- wireless/bluetooth/bt_netdev.c | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/nuttx/wireless/bluetooth/bt_driver.h b/include/nuttx/wireless/bluetooth/bt_driver.h index 0947a4dd37..66d9f38c51 100644 --- a/include/nuttx/wireless/bluetooth/bt_driver.h +++ b/include/nuttx/wireless/bluetooth/bt_driver.h @@ -84,9 +84,17 @@ struct bt_driver_s CODE int (*ioctl)(FAR struct bt_driver_s *btdev, int cmd, unsigned long arg); - /* Filled by register function, shouldn't be touched by bt_driver_s */ + /* For private use by device drivers. + * Should NOT be touched by the bluetooth stack. + */ FAR void *priv; + + /* Reserved for the bluetooth stack. + * Should NOT be touched by drivers. + */ + + FAR void *bt_net; }; /**************************************************************************** diff --git a/wireless/bluetooth/bt_netdev.c b/wireless/bluetooth/bt_netdev.c index d146560707..9d829a0be7 100644 --- a/wireless/bluetooth/bt_netdev.c +++ b/wireless/bluetooth/bt_netdev.c @@ -1194,7 +1194,7 @@ int bt_netdev_register(FAR struct bt_driver_s *btdev) /* Get the interface structure associated with this interface number. */ - priv = (FAR struct btnet_driver_s *) + btdev->bt_net = priv = (FAR struct btnet_driver_s *) kmm_zalloc(sizeof(struct btnet_driver_s)); if (priv == NULL)