Skip to content

Commit c7370fc

Browse files
rugeGerritsenrlubos
authored andcommitted
samples: Bluetooth: Initialize conn to NULL for bt_conn_le_create()
After zephyrproject-rtos/zephyr#79856 a warning message is printed out if the connection object is not initialized to NULL. This commit addresses this by initialing it. Signed-off-by: Rubin Gerritsen <[email protected]> (cherry picked from commit 9dbb6db)
1 parent a28f349 commit c7370fc

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

samples/bluetooth/central_bas/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static void scan_filter_no_match(struct bt_scan_device_info *device_info,
6868
bool connectable)
6969
{
7070
int err;
71-
struct bt_conn *conn;
71+
struct bt_conn *conn = NULL;
7272
char addr[BT_ADDR_LE_STR_LEN];
7373

7474
if (device_info->recv_info->adv_type == BT_GAP_ADV_TYPE_ADV_DIRECT_IND) {

samples/bluetooth/central_hids/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static void scan_filter_no_match(struct bt_scan_device_info *device_info,
9696
bool connectable)
9797
{
9898
int err;
99-
struct bt_conn *conn;
99+
struct bt_conn *conn = NULL;
100100
char addr[BT_ADDR_LE_STR_LEN];
101101

102102
if (device_info->recv_info->adv_type == BT_GAP_ADV_TYPE_ADV_DIRECT_IND) {

samples/bluetooth/central_nfc_pairing/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static void scan_filter_no_match(struct bt_scan_device_info *device_info,
120120
bool connectable)
121121
{
122122
int err;
123-
struct bt_conn *conn;
123+
struct bt_conn *conn = NULL;
124124
char addr[BT_ADDR_LE_STR_LEN];
125125

126126
if (device_info->recv_info->adv_type == BT_GAP_ADV_TYPE_ADV_DIRECT_IND) {

samples/bluetooth/iso_combined_bis_and_cis/src/combined_bis_cis.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static void scan_recv(const struct bt_le_scan_recv_info *info, struct net_buf_si
101101
const struct bt_le_conn_param *conn_param =
102102
BT_LE_CONN_PARAM(ACL_INTERVAL_BLE_UNITS, ACL_INTERVAL_BLE_UNITS, 0, 400);
103103

104-
struct bt_conn *conn;
104+
struct bt_conn *conn = NULL;
105105
int err = bt_conn_le_create(info->addr, BT_CONN_LE_CREATE_CONN, conn_param, &conn);
106106

107107
if (err) {

samples/bluetooth/iso_time_sync/src/cis_central.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static void scan_recv(const struct bt_le_scan_recv_info *info, struct net_buf_si
8383
return;
8484
}
8585

86-
struct bt_conn *conn;
86+
struct bt_conn *conn = NULL;
8787
int err = bt_conn_le_create(info->addr, BT_CONN_LE_CREATE_CONN, BT_LE_CONN_PARAM_DEFAULT,
8888
&conn);
8989
if (err) {

samples/bluetooth/radio_notification_cb/src/central.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type,
5454
return;
5555
}
5656

57-
struct bt_conn *unused_conn;
57+
struct bt_conn *unused_conn = NULL;
5858

5959
err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN,
6060
BT_LE_CONN_PARAM_DEFAULT, &unused_conn);

0 commit comments

Comments
 (0)