Skip to content

Conversation

@lyakh
Copy link
Collaborator

@lyakh lyakh commented Aug 22, 2025

No description provided.

Copilot AI review requested due to automatic review settings August 22, 2025 14:53
Copy link

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 PR contains minor cosmetic code improvements across three audio processing files, focusing on code cleanup and documentation fixes.

  • Removes an unreachable return statement in IPC helper code
  • Fixes variable declaration order in module adapter preparation
  • Corrects a typo in documentation and simplifies a list iteration

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/ipc/ipc-helper.c Removes unreachable return statement after conditional branch
src/audio/module_adapter/module_adapter.c Moves variable declaration outside of loop for better scoping
src/audio/module_adapter/module/generic.c Fixes typo in comment and simplifies list iteration by removing unused safe iterator
Comments suppressed due to low confidence (1)

src/ipc/ipc-helper.c:178

  • Removing this return statement changes the function's behavior. The code after the if-else block will now execute when there are no connected buffers, which may not be the intended logic. Verify that this change is correct and that the subsequent code should run in the 'no connected buffers' case.
	} else {

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

/**
* Allocates aligned memory block for module.
* @param mod Pointer to the module this memory block is allocatd for.
* @param mod Pointer to the module this memory block is allocated for.
Copy link

Copilot AI Aug 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed typo: 'allocatd' corrected to 'allocated'.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not fully agreeing with all the changes, but net positive for the series.

return 0;
}

/**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is first patch is really not just a cosmetic fix.

size_t size = MAX(mod->deep_buff_bytes, mod->period_bytes);
size_t size = MAX(mod->deep_buff_bytes, mod->period_bytes);

list_for_item(blist, &dev->bsource_list) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, compiler should optimize that out? This does bring "size" to the wider scope, so not sure if this is better. Not blocking...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kv2019i I'm not sure the compiler is able to deduce that mod->deep_buff_bytes and mod->period_bytes don't change while the loop is executed. So I wouldn't rely on that

@lyakh lyakh changed the title 3 cosmetic patches 3 cosmetic and minor improvement patches Sep 10, 2025
The size calculation in module_adapter_prepare() is constant over all
loop iterations, move it out of the loop.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Remove a redundant return statement.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
@lyakh lyakh changed the title 3 cosmetic and minor improvement patches 2 cosmetic and minor improvement patches Sep 10, 2025
@lgirdwood
Copy link
Member

@lyakh can you check CI thanks !

@lyakh
Copy link
Collaborator Author

lyakh commented Sep 11, 2025

@kv2019i kv2019i merged commit 9f41943 into thesofproject:main Sep 11, 2025
37 of 45 checks passed
@lyakh lyakh deleted the cleanup branch September 12, 2025 05:41
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.

4 participants