From 36807f2b564cdff16c8fc513879e2c972238bc68 Mon Sep 17 00:00:00 2001 From: Sebastian Larsson Date: Thu, 30 Apr 2026 14:32:03 +0200 Subject: [PATCH] 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 --- backends/arm/runtime/EthosUBackend_Cortex_M.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backends/arm/runtime/EthosUBackend_Cortex_M.cpp b/backends/arm/runtime/EthosUBackend_Cortex_M.cpp index c88bcfb2e12..7962ef846df 100644 --- a/backends/arm/runtime/EthosUBackend_Cortex_M.cpp +++ b/backends/arm/runtime/EthosUBackend_Cortex_M.cpp @@ -68,8 +68,11 @@ Error platform_execute( char* ethosu_scratch) { // Parse product config from command stream to reserve the correct driver uint32_t product, log2_macs; - if (ethosu_get_product_config_from_cop_data( - handles.cmd_data, handles.cmd_data_size, &product, &log2_macs) != 0) { + // The weak fallback below always returns 0, but some builds replace it + // with a real driver implementation that can return an error code. + const int product_config_status = ethosu_get_product_config_from_cop_data( + handles.cmd_data, handles.cmd_data_size, &product, &log2_macs); + if (product_config_status != 0) { // cppcheck-suppress knownConditionTrueFalse ET_LOG(Error, "Failed to parse product config from command stream"); return Error::InvalidProgram; }