-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Bluetooth: ASCS: Sonarcloud fixes #90443
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
Made a few complex functions simpler Added missing default cases in switches Fixes a bad cast that removed const Moved loop iterators to inner loop Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
|
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 pull request primarily simplifies several complex functions in the Bluetooth ASCS module while addressing SonarCloud issues. Key changes include adding missing default cases in switch statements, refactoring error‐handling checks (using “if (err != 0)” in place of “if (err)”), and introducing a multi-CCID existence check.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
subsys/bluetooth/audio/cap_internal.h | Added prototype for checking multiple CCIDs existence. |
subsys/bluetooth/audio/cap_acceptor.c | Implemented a new function to validate multiple CCIDs and introduced related logging comments. |
subsys/bluetooth/audio/ascs_internal.h | Added default cases in various inline string conversion functions. |
subsys/bluetooth/audio/ascs.c | Refactored error checking, loop index types, codec configuration, and overall error handling. |
Comments suppressed due to low confidence (3)
subsys/bluetooth/audio/ascs.c:1670
- [nitpick] Downgrading the error log to debug level in a failure case may obscure critical issues; please confirm that this change in log level is intentional.
LOG_DBG("Config failed: err %d, stream %p, code %u, reason %u", err, stream, rsp.code, rsp.reason);
subsys/bluetooth/audio/ascs.c:2175
- Since data_len is used as the CCID count, please verify that it accurately represents the number of CCIDs provided to prevent unexpected behavior if the metadata format changes.
if (IS_ENABLED(CONFIG_BT_CAP_ACCEPTOR) && !bt_cap_acceptor_ccids_exist(result->ep->stream->conn, data_value, data_len)) {
subsys/bluetooth/audio/ascs.c:2436
- [nitpick] Ensure that using a uint8_t for the loop index is appropriate given the expected range of req->num_ases to avoid potential overflow issues.
for (uint8_t i = 0U; i < req->num_ases; i++) {
Made a few complex functions simpler
Added missing default cases in switches
Fixes a bad cast that removed const
Moved loop iterators to inner loop