Skip to content

Commit 36807f2

Browse files
Arm backend: Suppress cppcheck false positive in Cortex-M
Document that the local weak fallback always returns 0, while some builds replace it with a driver implementation that can return an error. Add a targeted cppcheck suppression for the weak-symbol error check without changing runtime behavior. Change-Id: I71232d1b9670fcca35e7343db2ceccb519827969 Signed-off-by: Sebastian Larsson <sebastian.larsson@arm.com>
1 parent a6ee309 commit 36807f2

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

backends/arm/runtime/EthosUBackend_Cortex_M.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,11 @@ Error platform_execute(
6868
char* ethosu_scratch) {
6969
// Parse product config from command stream to reserve the correct driver
7070
uint32_t product, log2_macs;
71-
if (ethosu_get_product_config_from_cop_data(
72-
handles.cmd_data, handles.cmd_data_size, &product, &log2_macs) != 0) {
71+
// The weak fallback below always returns 0, but some builds replace it
72+
// with a real driver implementation that can return an error code.
73+
const int product_config_status = ethosu_get_product_config_from_cop_data(
74+
handles.cmd_data, handles.cmd_data_size, &product, &log2_macs);
75+
if (product_config_status != 0) { // cppcheck-suppress knownConditionTrueFalse
7376
ET_LOG(Error, "Failed to parse product config from command stream");
7477
return Error::InvalidProgram;
7578
}

0 commit comments

Comments
 (0)