From 469501170dc6c3316f1a91bc9f40a02f99a68be3 Mon Sep 17 00:00:00 2001 From: Praveen Chandran Date: Tue, 11 Apr 2023 09:12:32 -0700 Subject: [PATCH] [Infineon] Fix for successorexit return error for PSoC6 platform (#26042) --- .../Infineon/PSOC6/ConnectivityManagerImpl.cpp | 5 +++-- .../Infineon/PSOC6/DiagnosticDataProviderImpl.cpp | 14 +++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/platform/Infineon/PSOC6/ConnectivityManagerImpl.cpp b/src/platform/Infineon/PSOC6/ConnectivityManagerImpl.cpp index a005d88f01fe5a..ef1d25072f5e39 100644 --- a/src/platform/Infineon/PSOC6/ConnectivityManagerImpl.cpp +++ b/src/platform/Infineon/PSOC6/ConnectivityManagerImpl.cpp @@ -176,12 +176,13 @@ CHIP_ERROR ConnectivityManagerImpl::_GetAndLogWiFiStatsCounters(void) { cy_wcm_associated_ap_info_t ap_info; cy_rslt_t result = CY_RSLT_SUCCESS; + CHIP_ERROR err = CHIP_NO_ERROR; result = cy_wcm_get_associated_ap_info(&ap_info); if (result != CY_RSLT_SUCCESS) { ChipLogError(DeviceLayer, "cy_wcm_get_associated_ap_info failed: %d", (int) result); - SuccessOrExit(CHIP_ERROR_INTERNAL); + SuccessOrExit(err = CHIP_ERROR_INTERNAL); } ChipLogProgress(DeviceLayer, @@ -193,7 +194,7 @@ CHIP_ERROR ConnectivityManagerImpl::_GetAndLogWiFiStatsCounters(void) ap_info.BSSID[0], ap_info.BSSID[1], ap_info.BSSID[2], ap_info.BSSID[3], ap_info.BSSID[4], ap_info.BSSID[5], ap_info.signal_strength, ap_info.channel, ap_info.channel_width); exit: - return CHIP_NO_ERROR; + return err; } // ==================== ConnectivityManager Platform Internal Methods ==================== diff --git a/src/platform/Infineon/PSOC6/DiagnosticDataProviderImpl.cpp b/src/platform/Infineon/PSOC6/DiagnosticDataProviderImpl.cpp index 076238a2f52899..b5635b6ead0353 100644 --- a/src/platform/Infineon/PSOC6/DiagnosticDataProviderImpl.cpp +++ b/src/platform/Infineon/PSOC6/DiagnosticDataProviderImpl.cpp @@ -193,7 +193,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiBssId(ByteSpan & value) if (result != CY_RSLT_SUCCESS) { ChipLogError(DeviceLayer, "cy_wcm_get_associated_ap_info failed: %d", (int) result); - SuccessOrExit(CHIP_ERROR_INTERNAL); + SuccessOrExit(err = CHIP_ERROR_INTERNAL); } memcpy(mWiFiMacAddress, ap_info.BSSID, CY_WCM_MAC_ADDR_LEN); value = ByteSpan(mWiFiMacAddress, CY_WCM_MAC_ADDR_LEN); @@ -214,7 +214,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiSecurityType(app::Clusters::WiFiNe if (result != CY_RSLT_SUCCESS) { ChipLogError(DeviceLayer, "cy_wcm_get_associated_ap_info failed: %d", (int) result); - SuccessOrExit(CHIP_ERROR_INTERNAL); + SuccessOrExit(err = CHIP_ERROR_INTERNAL); } if (ap_info.security == CY_WCM_SECURITY_OPEN) { @@ -289,7 +289,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiChannelNumber(uint16_t & channelNu if (result != CY_RSLT_SUCCESS) { ChipLogError(DeviceLayer, "cy_wcm_get_associated_ap_info failed: %d", (int) result); - SuccessOrExit(CHIP_ERROR_INTERNAL); + SuccessOrExit(err = CHIP_ERROR_INTERNAL); } channelNumber = ap_info.channel; @@ -307,7 +307,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiRssi(int8_t & rssi) if (result != CY_RSLT_SUCCESS) { ChipLogError(DeviceLayer, "cy_wcm_get_associated_ap_info failed: %d", (int) result); - SuccessOrExit(CHIP_ERROR_INTERNAL); + SuccessOrExit(err = CHIP_ERROR_INTERNAL); } rssi = ap_info.signal_strength; @@ -350,7 +350,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiCurrentMaxRate(uint64_t & currentM if (result != CY_RSLT_SUCCESS) { ChipLogError(DeviceLayer, "cy_wcm_get_wlan_statistics failed: %d", (int) result); - SuccessOrExit(CHIP_ERROR_INTERNAL); + SuccessOrExit(err = CHIP_ERROR_INTERNAL); } count = stats.tx_bitrate * PHYRATE_KPBS_BYTES_PER_SEC; currentMaxRate = static_cast(count); @@ -394,7 +394,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiPacketUnicastRxCount(uint32_t & pa if (result != CY_RSLT_SUCCESS) { ChipLogError(DeviceLayer, "cy_wcm_get_wlan_statistics failed: %d", (int) result); - SuccessOrExit(CHIP_ERROR_INTERNAL); + SuccessOrExit(err = CHIP_ERROR_INTERNAL); } count = stats.rx_packets; count -= mPacketUnicastRxCount; @@ -417,7 +417,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiPacketUnicastTxCount(uint32_t & pa if (result != CY_RSLT_SUCCESS) { ChipLogError(DeviceLayer, "cy_wcm_get_wlan_statistics failed: %d", (int) result); - SuccessOrExit(CHIP_ERROR_INTERNAL); + SuccessOrExit(err = CHIP_ERROR_INTERNAL); } count = stats.tx_packets;