Skip to content

src: cosmetic: simplify an invalid configuration check#10626

Open
lyakh wants to merge 1 commit intothesofproject:mainfrom
lyakh:src
Open

src: cosmetic: simplify an invalid configuration check#10626
lyakh wants to merge 1 commit intothesofproject:mainfrom
lyakh:src

Conversation

@lyakh
Copy link
Collaborator

@lyakh lyakh commented Mar 16, 2026

The condition delay_lines_size == 0 in src_params_general() can trigger if cd->param.total == 0 or if cd->param.total == -1. However, the latter is supposedly invalid and should be checked in a more generic non-negativity test, so here it suffices to just check cd->param.total != 0 before delay_lines_size is calculated.

The condition delay_lines_size == 0 in src_params_general() can
trigger if cd->param.total == 0 or if cd->param.total == -1. However,
the latter is supposedly invalid and should be checked in a more
generic non-negativity test, so here it suffices to just check
cd->param.total != 0 before delay_lines_size is calculated.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Copilot AI review requested due to automatic review settings March 16, 2026 10:55
Copy link
Contributor

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

Simplifies the invalid configuration check in src_params_general() by directly validating cd->param.total before computing delay_lines_size.

Changes:

  • Reorders validation to check cd->param.total == 0 before calculating delay_lines_size.
  • Updates the error message emitted on invalid configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +526 to 532
if (cd->param.total == 0) {
comp_err(dev, "configuration failed: delay_lines_size = 0");

return -EINVAL;
}
delay_lines_size = ALIGN_UP(sizeof(int32_t) * cd->param.total, 8);

if (delay_lines_size == 0) {
comp_err(dev, "delay_lines_size = 0");
if (cd->param.total == 0) {
comp_err(dev, "configuration failed: delay_lines_size = 0");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants