From 3b7f1d4ca64b3ebc8ceddb23f6dd14c83d8d02d6 Mon Sep 17 00:00:00 2001 From: Shubham Patil Date: Mon, 23 Mar 2026 15:55:00 +0530 Subject: [PATCH 1/2] components/esp_matter: propagate error code from attribute report on v1.4.2 attribute::report() was ignoring the return value from set_val() and always returning ESP_OK. This hid errors like ESP_ERR_NOT_SUPPORTED for internally managed attributes (e.g., BooleanState::StateValue). This fix: - Propagates the error from set_val() back to the caller - Checks return value of get_val() in report() - Adds void cast to intentionally unchecked get_data_from_attr_val() call in update() Related: https://github.com/espressif/esp-matter/issues/1724 Backport of !1441 (main) --- .../esp_matter/esp_matter_attribute_utils.cpp | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/components/esp_matter/esp_matter_attribute_utils.cpp b/components/esp_matter/esp_matter_attribute_utils.cpp index 49b73ab6c..c206ed003 100644 --- a/components/esp_matter/esp_matter_attribute_utils.cpp +++ b/components/esp_matter/esp_matter_attribute_utils.cpp @@ -1,4 +1,4 @@ -// Copyright 2021 Espressif Systems (Shanghai) PTE LTD +// Copyright 2021-2026 Espressif Systems (Shanghai) PTE LTD // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -536,7 +536,7 @@ static esp_err_t console_set_handler(int argc, char **argv) attribute_id); VerifyOrReturnError(matter_attribute, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Matter attribute not found")); - /* Use the type to create the val and then update te attribute */ + /* Use the type to create the val and then update the attribute */ esp_matter_val_type_t type = get_val_type_from_attribute_type(matter_attribute->attributeType); esp_matter_attr_val_t val = esp_matter_invalid(NULL); if (type == ESP_MATTER_VAL_TYPE_BOOLEAN) { @@ -2069,7 +2069,8 @@ esp_err_t update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_i } return ESP_ERR_NO_MEM; } - get_data_from_attr_val(val, &attribute_type, &attribute_size, value); + /* Ignore return value: identical call succeeded above with NULL value buffer */ + (void)get_data_from_attr_val(val, &attribute_type, &attribute_size, value); /* Update matter */ Status status = Status::Success; @@ -2112,7 +2113,15 @@ esp_err_t report(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_i /* Update attribute */ esp_matter_attr_val_t raw_val = esp_matter_invalid(NULL); - attribute::get_val(attribute, &raw_val); + esp_err_t err = attribute::get_val(attribute, &raw_val); + if (err != ESP_OK) { + ESP_LOGE(TAG, "Failed to get the attribute value for Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32 " err: %d", + endpoint_id, cluster_id, attribute_id, err); + if (lock_status == lock::SUCCESS) { + lock::chip_stack_unlock(); + } + return err; + } if (val->type != raw_val.type) { ESP_LOGE(TAG, "Attribute type mismatch when trying to report Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32, endpoint_id, cluster_id, attribute_id); @@ -2121,7 +2130,15 @@ esp_err_t report(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_i } return ESP_FAIL; } - attribute::set_val(attribute, val); + err = attribute::set_val(attribute, val); + if (err != ESP_OK) { + ESP_LOGE(TAG, "Failed to set attribute value for Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32 " err: %d", + endpoint_id, cluster_id, attribute_id, err); + if (lock_status == lock::SUCCESS) { + lock::chip_stack_unlock(); + } + return err; + } #endif /* Report attribute */ MatterReportingAttributeChangeCallback(endpoint_id, cluster_id, attribute_id); From 60adb53d75c11215fcb691394a451c151ad6cb04 Mon Sep 17 00:00:00 2001 From: Shubham Patil Date: Mon, 23 Mar 2026 16:12:31 +0530 Subject: [PATCH 2/2] ci: use the target branch for comapring typos --- .gitlab-ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9c9eb24e2..346be46af 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -745,9 +745,10 @@ check_typos: stage: check_typos script: - pip install codespell - - git fetch origin main + # Use target branch for MR pipelines, fallback to main for branch push pipelines + - git fetch origin ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-main} - | - FILES=$(git diff --name-only origin/main...HEAD) + FILES=$(git diff --name-only origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-main}...HEAD) echo "change files: $FILES" if [ -n "$FILES" ]; then ./tools/check_typos.sh $FILES