Skip to content

Commit

Permalink
Bluetooth: Mesh: Fix dead code issue when getting node id state
Browse files Browse the repository at this point in the history
Refactor the function to avoid dead code.

Coverity-CID: 321153
Fixes #59527

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
  • Loading branch information
PavelVPV authored and carlescufi committed Jun 22, 2023
1 parent a16bcd2 commit c214ec3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions subsys/bluetooth/mesh/subnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,15 +695,13 @@ uint8_t bt_mesh_subnet_priv_node_id_get(uint16_t net_idx,
enum bt_mesh_subnets_node_id_state bt_mesh_subnets_node_id_state_get(void)
{
for (int i = 0; i < ARRAY_SIZE(subnets); i++) {
bool priv_node_id = false;

if (subnets[i].node_id) {
#if CONFIG_BT_MESH_PRIV_BEACONS
priv_node_id = subnets[i].priv_beacon_ctx.node_id;
if (subnets[i].priv_beacon_ctx.node_id) {
return BT_MESH_SUBNETS_NODE_ID_STATE_ENABLED_PRIVATE;
}
#endif

if (subnets[i].node_id || priv_node_id) {
return priv_node_id ? BT_MESH_SUBNETS_NODE_ID_STATE_ENABLED_PRIVATE :
BT_MESH_SUBNETS_NODE_ID_STATE_ENABLED;
return BT_MESH_SUBNETS_NODE_ID_STATE_ENABLED;
}
}

Expand Down

0 comments on commit c214ec3

Please sign in to comment.