Skip to content

Conversation

@singalsu
Copy link
Collaborator

@singalsu singalsu commented May 9, 2025

Fixes to IGO NR, Smart Amp, IPC4 Helper, POSIX IPC to fix stub-build check.

@singalsu
Copy link
Collaborator Author

singalsu commented May 9, 2025

Not sure this is right way, now there's another:

sof/src/ipc/ipc4/helper.c:945:31: error: unused variable 'sof_uuid' [-Werror,-Wunused-variable]
const struct sof_uuid *const sof_uuid = (const struct sof_uuid *)uuid;
^
1 error generated.

The sof_uuid is used with tr_warn(). The stub_build step is possibly disabling all traces.

Edit - and a few more added. Seems these are relevant, so I'm not closing this.

@singalsu singalsu marked this pull request as ready for review May 9, 2025 12:55
Copilot AI review requested due to automatic review settings May 9, 2025 12:55
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 pull request addresses warnings about unused variables across multiple modules, contributing to cleaner builds on stub-check configurations.

  • In src/platform/posix/ipc.c, unused variables were removed or relocated under conditional compilation.
  • In src/ipc/ipc4/helper.c, an unused argument is explicitly cast to void.
  • In the smart amp modules and IGO NR modules, unused variables were removed or cast to void to prevent warnings.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/platform/posix/ipc.c Removed unused variable declarations and relocated them within a conditional block; removed an unused pointer assignment.
src/ipc/ipc4/helper.c Added an explicit cast for an unused variable to avoid warnings.
src/audio/smart_amp/smart_amp_generic.c Removed an unused variable (sink_ch).
src/audio/smart_amp/smart_amp.c Removed an unused variable (rate).
src/audio/igo_nr/igo_nr.c Added an explicit cast to avoid unused variable warnings.
Comments suppressed due to low confidence (1)

src/platform/posix/ipc.c:89

  • The removal of the 'cc' variable assignment is acceptable if this variable is not used in subsequent processing; please verify that its removal does not affect any later functionality.
struct sof_ipc_comp *cc = global_ipc->comp_data;

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.

Please consider __maybe_unused

struct comp_driver_info *info;
uint32_t flags;

(void)sof_uuid; /* Avoid possible warning of unused */
Copy link
Collaborator

Choose a reason for hiding this comment

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

@singalsu You should be able to use "__maybe_unused" attribute for these cases. See examples in Zephyr and SOF, often used for variables that are checked in asserts and log statements that may be omitted in production builds.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah that was it, I had vague memory of something like that but I could not find example. I'll change, stay tuned.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated now, it looks like the stubs build passed with green check mark with __maybe_unused.

singalsu added 6 commits May 13, 2025 10:30
This change avoids warning and error about:

sof/src/audio/igo_nr/igo_nr.c:678:20: error: unused variable
'cd' [-Werror,-Wunused-variable]
struct comp_data *cd = module_get_private_data(mod);

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This change avoids warning/error:

sof/src/ipc/ipc4/helper.c:945:31: error: unused variable
'sof_uuid' [-Werror,-Wunused-variable]

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The variable sink_ch is unused. This avoids warning/error:

sof/workspace/sof/src/audio/smart_amp/smart_amp_generic.c:224:6:
error: unused variable 'sink_ch' [-Werror,-Wunused-variable]

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This change avoid errors:

sof/src/platform/posix/ipc.c:48:7: error: unused variable
'comp_new' [-Werror,-Wunused-variable]

sof/src/platform/posix/ipc.c:49:6: error: unused variable
'comp_idx' [-Werror,-Wunused-variable]

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This change fixes warning/error:

sof/src/audio/smart_amp/smart_amp.c:736:11: error: unused
variable 'rate' [-Werror,-Wunused-variable]

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This change avoids error:

sof/src/platform/posix/ipc.c:90:23: error: unused
variable 'cc' [-Werror,-Wunused-variable]

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@singalsu singalsu force-pushed the igonr_avoid_warn_unused branch from e065d09 to 6d77c9d Compare May 13, 2025 07:39
@singalsu singalsu requested review from Copilot and kv2019i May 13, 2025 07: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 removes unused variable warnings and resolves stub-build check issues in various audio and IPC modules.

  • Removed unused variable declarations in posix IPC code.
  • Marked unused variables with __maybe_unused in IPC4 Helper and IGO NR.
  • Removed redundant unused variables in Smart Amp modules.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/platform/posix/ipc.c Removed unused variables and relocated declarations conditionally
src/ipc/ipc4/helper.c Marked variable as __maybe_unused to suppress warnings
src/audio/smart_amp/smart_amp_generic.c Removed unused local variable
src/audio/smart_amp/smart_amp.c Removed unused variable from the prepare function
src/audio/igo_nr/igo_nr.c Marked unused variable as __maybe_unused

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.

this completely supersedes #10001

@lyakh lyakh changed the title Audio: IGO NR: Avoid warning about unused variable global: Avoid warnings about unused variables May 13, 2025
@lyakh
Copy link
Collaborator

lyakh commented May 13, 2025

@singalsu I've updated the PR title to better reflect what it fixes

@lgirdwood lgirdwood merged commit 5a1d8df into thesofproject:main May 13, 2025
42 of 48 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