Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Thalley
Copy link
Collaborator

@Thalley Thalley commented May 24, 2025

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

@Thalley Thalley force-pushed the sonarcloud_ascs branch from bc0322d to 454c772 Compare May 25, 2025 12:19
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>
@Thalley Thalley force-pushed the sonarcloud_ascs branch from 454c772 to c909e34 Compare May 25, 2025 12:21
Copy link

Copy link

@Copilot Copilot AI left a 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++) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

1 participant