Skip to content

Conversation

@jsarha
Copy link
Contributor

@jsarha jsarha commented Oct 10, 2025

No description provided.

Copilot AI review requested due to automatic review settings October 10, 2025 11:38
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 converts NXP, RTNR, and Selector audio modules to use module-based memory allocation APIs instead of direct SOF memory allocation. The conversion standardizes memory management across these modules by using the module API pattern for allocation and automatic cleanup.

  • Replaces direct memory allocation/deallocation with module-managed memory APIs
  • Simplifies error handling by removing manual cleanup paths in init functions
  • Updates free functions to rely on automatic module cleanup instead of explicit memory deallocation

Reviewed Changes

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

File Description
src/audio/selector/selector.c Converts to mod_zalloc and removes manual memory cleanup
src/audio/rtnr/rtnr.c Updates allocation APIs and simplifies error handling paths
src/audio/nxp/eap.c Migrates to module memory APIs and removes manual buffer management

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

comp_err(dev, "nxp_eap_init() failed to get instance handle err: %d", lvm_ret);
ret = -EINVAL;
goto free_mem;
return -EINVAL;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this would leak memory? This is initialisation, if initialisation fails, the destructor isn't called.

comp_err(dev, "comp_data_blob_handler_new() failed.");
ret = -ENOMEM;
goto cd_fail;
return -ENOMEM;
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here. Please check other cases as well

Copy link
Collaborator

@lyakh lyakh left a comment

Choose a reason for hiding this comment

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

fixed by #10320

Jyri Sarha added 3 commits October 31, 2025 17:44
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>
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>
Allocate all memory, blob handlers, and fast_get() buffers through
module API mod_alloc() and friends.

The IPC3 implementation of selector uses the component interface
directly and can not use the new module API.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
@jsarha jsarha force-pushed the module_api_nxp_rtnr_selector branch from 43409ed to 089610a Compare October 31, 2025 15:45
@jsarha
Copy link
Contributor Author

jsarha commented Oct 31, 2025

These new versions of module conversions use module API to allocate the resources, but the code still has all the resource freeing code in place.

@lgirdwood
Copy link
Member

@lrudyX jenkins looking OK, real issue or do we need a rerun ?

@lrudyX
Copy link

lrudyX commented Nov 3, 2025

@lrudyX jenkins looking OK, real issue or do we need a rerun ?

Looks like False positive, waits for rerun.

@lgirdwood lgirdwood merged commit bc282b6 into thesofproject:main Nov 3, 2025
37 of 42 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.

6 participants