-
Notifications
You must be signed in to change notification settings - Fork 7.7k
BAP Broadcast Assistant sonarcloud fixes #91589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses SonarCloud-reported maintainability issues in the BAP Broadcast Assistant discovery logic by separating index computation from state-count increment and adding handling for unexpected UUIDs.
- Split
recv_state_cnt
increment out of the index assignment to avoid side effects. - Introduced an
else
branch to abort discovery on invalid UUIDs with an error callback. - Adjusted log placement around
recv_state_cnt
.
Comments suppressed due to low confidence (2)
subsys/bluetooth/audio/bap_broadcast_assistant.c:710
- [nitpick] The log statement prints
inst->recv_state_cnt
before it is incremented, changing the original behavior. Consider loggingidx
or moving this log after theinst->recv_state_cnt++
increment to reflect the correct count.
LOG_DBG("Receive State %u", inst->recv_state_cnt);
subsys/bluetooth/audio/bap_broadcast_assistant.c:720
- Passing
0
forrecv_state_count
on error hides how many states were discovered before the failure. Consider passinginst->recv_state_cnt
to give callers the actual count.
bap_broadcast_assistant_discover_complete(conn, -EBADMSG, 0);
a8f09a9
to
39663bf
Compare
If the chrc->uuid is somehow an invalid UUID, we log it and terminate the discovery procedure. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Sonarcloud does not allow to use the result of a incremental (++) as an assignment. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
39663bf
to
1ef7d2f
Compare
|
Fixes a few issues reported by Sonarcloud