Skip to content

Conversation

@jsarha
Copy link
Contributor

@jsarha jsarha commented Oct 23, 2025

Allocate all memory, blob handlers, and fast_get() buffers through module API mod_alloc() and friends.

Copilot AI review requested due to automatic review settings October 23, 2025 10:20
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 transitions the volume module to use the module API's automatic memory management system. By replacing manual memory allocation functions (rzalloc, rmalloc, rfree) with module API equivalents (mod_zalloc, mod_alloc), the code leverages automatic cleanup when the module unloads, eliminating the need for manual cleanup in error paths and the free function.

Key changes:

  • Replaced manual memory allocation with module API allocation functions
  • Removed manual memory deallocation from error paths and cleanup functions
  • Removed the now-unused rtos/alloc.h include

Reviewed Changes

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

File Description
src/audio/volume/volume_ipc4.c Converted memory allocations to mod_alloc/mod_zalloc and removed manual cleanup calls
src/audio/volume/volume_ipc3.c Converted memory allocations to mod_alloc/mod_zalloc and removed manual cleanup calls
src/audio/volume/volume.c Removed manual rfree() calls from volume_free() function

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

@lgirdwood
Copy link
Member

SOFCI TEST

Allocate all memory, blob handlers, and fast_get() buffers through
module API mod_alloc() and friends.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
@jsarha jsarha force-pushed the module_api_volume branch from bd13751 to 3252247 Compare October 28, 2025 16:02
@jsarha
Copy link
Contributor Author

jsarha commented Oct 28, 2025

This new version of volume module using module API to allocate resources still has all the resource freeing code in place.

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

@softwarecki fyi - now keeps the free.

@lgirdwood
Copy link
Member

@lrudyX good to merge ? other CI looks good.

Copy link
Collaborator

@softwarecki softwarecki left a comment

Choose a reason for hiding this comment

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

Keeping mod_free as-is, we have a plan to make tracking optional, so I don't see any blockers.

@lgirdwood lgirdwood merged commit 9ed5472 into thesofproject:main Oct 30, 2025
39 of 45 checks passed
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.

5 participants