Bluetooth: Mesh: Check return value of bt_conn_get_info
Coverity-CID: 323094 Fixes #65366 Coverity-CID: 323081 Fixes #65370 Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This commit is contained in:
parent
6a5d082cc5
commit
b15611eb28
|
@ -176,8 +176,8 @@ static void gatt_connected(struct bt_conn *conn, uint8_t conn_err)
|
|||
struct bt_conn_info info;
|
||||
int err;
|
||||
|
||||
bt_conn_get_info(conn, &info);
|
||||
if (info.role != BT_CONN_ROLE_CENTRAL ||
|
||||
err = bt_conn_get_info(conn, &info);
|
||||
if (err || info.role != BT_CONN_ROLE_CENTRAL ||
|
||||
!server->gatt) {
|
||||
return;
|
||||
}
|
||||
|
@ -214,9 +214,10 @@ static void gatt_disconnected(struct bt_conn *conn, uint8_t reason)
|
|||
{
|
||||
struct bt_conn_info info;
|
||||
struct bt_mesh_gatt_server *server = get_server(conn);
|
||||
int err;
|
||||
|
||||
bt_conn_get_info(conn, &info);
|
||||
if (info.role != BT_CONN_ROLE_CENTRAL ||
|
||||
err = bt_conn_get_info(conn, &info);
|
||||
if (err || info.role != BT_CONN_ROLE_CENTRAL ||
|
||||
!server->gatt) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -94,27 +94,29 @@ static ssize_t gatt_recv(struct bt_conn *conn,
|
|||
return bt_mesh_proxy_msg_recv(conn, buf, len);
|
||||
}
|
||||
|
||||
static void gatt_connected(struct bt_conn *conn, uint8_t err)
|
||||
static void gatt_connected(struct bt_conn *conn, uint8_t conn_err)
|
||||
{
|
||||
struct bt_conn_info info;
|
||||
int err;
|
||||
|
||||
bt_conn_get_info(conn, &info);
|
||||
if (info.role != BT_CONN_ROLE_PERIPHERAL || !service_registered ||
|
||||
err = bt_conn_get_info(conn, &info);
|
||||
if (err || info.role != BT_CONN_ROLE_PERIPHERAL || !service_registered ||
|
||||
bt_mesh_is_provisioned() || info.id != BT_ID_DEFAULT || cli) {
|
||||
return;
|
||||
}
|
||||
|
||||
cli = bt_mesh_proxy_role_setup(conn, gatt_send, proxy_msg_recv);
|
||||
|
||||
LOG_DBG("conn %p err 0x%02x", (void *)conn, err);
|
||||
LOG_DBG("conn %p err 0x%02x", (void *)conn, conn_err);
|
||||
}
|
||||
|
||||
static void gatt_disconnected(struct bt_conn *conn, uint8_t reason)
|
||||
{
|
||||
struct bt_conn_info info;
|
||||
int err;
|
||||
|
||||
bt_conn_get_info(conn, &info);
|
||||
if (info.role != BT_CONN_ROLE_PERIPHERAL || !service_registered ||
|
||||
err = bt_conn_get_info(conn, &info);
|
||||
if (err || info.role != BT_CONN_ROLE_PERIPHERAL || !service_registered ||
|
||||
info.id != BT_ID_DEFAULT || !cli || cli->conn != conn) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1057,18 +1057,19 @@ static void solicitation_reset(struct bt_mesh_subnet *sub)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void gatt_connected(struct bt_conn *conn, uint8_t err)
|
||||
static void gatt_connected(struct bt_conn *conn, uint8_t conn_err)
|
||||
{
|
||||
struct bt_mesh_proxy_client *client;
|
||||
struct bt_conn_info info;
|
||||
int err;
|
||||
|
||||
bt_conn_get_info(conn, &info);
|
||||
if (info.role != BT_CONN_ROLE_PERIPHERAL || !service_registered ||
|
||||
err = bt_conn_get_info(conn, &info);
|
||||
if (err || info.role != BT_CONN_ROLE_PERIPHERAL || !service_registered ||
|
||||
info.id != BT_ID_DEFAULT) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_DBG("conn %p err 0x%02x", (void *)conn, err);
|
||||
LOG_DBG("conn %p err 0x%02x", (void *)conn, conn_err);
|
||||
|
||||
client = find_client(conn);
|
||||
|
||||
|
@ -1107,9 +1108,10 @@ static void gatt_disconnected(struct bt_conn *conn, uint8_t reason)
|
|||
{
|
||||
struct bt_conn_info info;
|
||||
struct bt_mesh_proxy_client *client;
|
||||
int err;
|
||||
|
||||
bt_conn_get_info(conn, &info);
|
||||
if (info.role != BT_CONN_ROLE_PERIPHERAL || info.id != BT_ID_DEFAULT) {
|
||||
err = bt_conn_get_info(conn, &info);
|
||||
if (err || info.role != BT_CONN_ROLE_PERIPHERAL || info.id != BT_ID_DEFAULT) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue