audio: cadence: add optional API error reporting#10604
audio: cadence: add optional API error reporting#10604ujfalusi wants to merge 1 commit intothesofproject:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the Cadence codec processing path to optionally report the underlying Cadence API error code to callers, while keeping the existing behavior where non-fatal API errors do not fail processing.
Changes:
- Extend
cadence_codec_process_data()with an optionalapi_error_codeoutput parameter. - Suppress non-fatal warning logs for selected Cadence API calls and add debug tracing when a stored API error code is overwritten.
- Update IPC3 and IPC4 Cadence module call sites to pass
NULLfor the new optional parameter.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/include/sof/audio/module_adapter/module/cadence.h | Updates the public function prototype to accept an optional API error output parameter. |
| src/audio/module_adapter/module/cadence.c | Implements optional API error code storage and overwrite tracing; suppresses non-fatal warning prints on the updated path. |
| src/audio/module_adapter/module/cadence_ipc3.c | Adapts the IPC3 processing call site to the new function signature by passing NULL. |
| src/audio/module_adapter/module/cadence_ipc4.c | Adapts the IPC4 processing call site to the new function signature by passing NULL. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| if (*api_error_code && *api_error_code != ret) | ||
| comp_dbg(dev, "overwriting api error code at %s: old %#x new %#x", | ||
| cmd_name, *api_error_code, ret); |
There was a problem hiding this comment.
comp_dbg() uses %#x to print int values (ret and *api_error_code). In C this format expects an unsigned int, so this can trigger format warnings/UB for negative (high-bit-set) error codes. Consider casting to unsigned (or switching the stored type to an unsigned/UWORD32) when printing.
| cmd_name, *api_error_code, ret); | |
| cmd_name, (unsigned int)*api_error_code, (unsigned int)ret); |
There was a problem hiding this comment.
well, the cadence codebase and defines are sloppy, this is what it is.
The error is described as bits (bit 31 - fatal, bit 11-14 class, etc), but defined as int.
| uint32_t direction); | ||
| int cadence_codec_apply_params(struct processing_module *mod, int size, void *data); | ||
| int cadence_codec_process_data(struct processing_module *mod); | ||
| int cadence_codec_process_data(struct processing_module *mod, int *api_error_code); |
There was a problem hiding this comment.
The new output parameter uses int *api_error_code, but Cadence defines XA_ERRORCODE (see xa_type_def.h). Using XA_ERRORCODE * here would make the API intent explicit and avoid accidental type mismatches if Cadence ever changes the underlying type.
| int cadence_codec_process_data(struct processing_module *mod, int *api_error_code); | |
| int cadence_codec_process_data(struct processing_module *mod, XA_ERRORCODE *api_error_code); |
There was a problem hiding this comment.
right, can be done, but the same 'int' is returned in case of error, again, it is not a purpose of the patch to correct the cadence module sloppy code.
Extend cadence_codec_process_data() with an optional output parameter for returning Cadence API error codes while preserving existing return behavior: non-fatal API errors still return 0 and fatal errors are returned. Suppress non-fatal warning prints in this path and add lightweight overwrite tracing for repeated API error updates. Update cadence IPC3 and IPC4 call sites to pass NULL for now. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
c44f608 to
d088eb0
Compare
|
Changes since v1:
|
Extend cadence_codec_process_data() with an optional output parameter for returning Cadence API error codes while preserving existing return behavior: non-fatal API errors still return 0 and fatal errors are returned.
Suppress non-fatal warning prints in this path and add lightweight overwrite tracing for repeated API error updates.
Update cadence IPC3 and IPC4 call sites to pass NULL for now.