@@ -142,7 +142,7 @@ static int set_random_address(const bt_addr_t *addr)
142142 return 0 ;
143143 }
144144
145- buf = bt_hci_cmd_create ( BT_HCI_OP_LE_SET_RANDOM_ADDRESS , sizeof ( * addr ) );
145+ buf = bt_hci_cmd_alloc ( K_FOREVER );
146146 if (!buf ) {
147147 return - ENOBUFS ;
148148 }
@@ -193,8 +193,7 @@ int bt_id_set_adv_random_addr(struct bt_le_ext_adv *adv,
193193 return 0 ;
194194 }
195195
196- buf = bt_hci_cmd_create (BT_HCI_OP_LE_SET_ADV_SET_RANDOM_ADDR ,
197- sizeof (* cp ));
196+ buf = bt_hci_cmd_alloc (K_FOREVER );
198197 if (!buf ) {
199198 return - ENOBUFS ;
200199 }
@@ -314,8 +313,7 @@ static void le_rpa_timeout_update(void)
314313 struct net_buf * buf ;
315314 struct bt_hci_cp_le_set_rpa_timeout * cp ;
316315
317- buf = bt_hci_cmd_create (BT_HCI_OP_LE_SET_RPA_TIMEOUT ,
318- sizeof (* cp ));
316+ buf = bt_hci_cmd_alloc (K_FOREVER );
319317 if (!buf ) {
320318 LOG_ERR ("Failed to create HCI RPA timeout command" );
321319 err = - ENOBUFS ;
@@ -850,7 +848,7 @@ static int le_set_privacy_mode(const bt_addr_le_t *addr, uint8_t mode)
850848 bt_addr_le_copy (& cp .id_addr , addr );
851849 cp .mode = mode ;
852850
853- buf = bt_hci_cmd_create ( BT_HCI_OP_LE_SET_PRIVACY_MODE , sizeof ( cp ) );
851+ buf = bt_hci_cmd_alloc ( K_FOREVER );
854852 if (!buf ) {
855853 return - ENOBUFS ;
856854 }
@@ -871,7 +869,7 @@ static int addr_res_enable(uint8_t enable)
871869
872870 LOG_DBG ("%s" , enable ? "enabled" : "disabled" );
873871
874- buf = bt_hci_cmd_create ( BT_HCI_OP_LE_SET_ADDR_RES_ENABLE , 1 );
872+ buf = bt_hci_cmd_alloc ( K_FOREVER );
875873 if (!buf ) {
876874 return - ENOBUFS ;
877875 }
@@ -893,7 +891,7 @@ static int hci_id_add(uint8_t id, const bt_addr_le_t *addr, uint8_t peer_irk[16]
893891
894892 LOG_DBG ("addr %s" , bt_addr_le_str (addr ));
895893
896- buf = bt_hci_cmd_create ( BT_HCI_OP_LE_ADD_DEV_TO_RL , sizeof ( * cp ) );
894+ buf = bt_hci_cmd_alloc ( K_FOREVER );
897895 if (!buf ) {
898896 return - ENOBUFS ;
899897 }
@@ -1212,7 +1210,7 @@ static int hci_id_del(const bt_addr_le_t *addr)
12121210
12131211 LOG_DBG ("addr %s" , bt_addr_le_str (addr ));
12141212
1215- buf = bt_hci_cmd_create ( BT_HCI_OP_LE_REM_DEV_FROM_RL , sizeof ( * cp ) );
1213+ buf = bt_hci_cmd_alloc ( K_FOREVER );
12161214 if (!buf ) {
12171215 return - ENOBUFS ;
12181216 }
0 commit comments