From b91800f128527d6e52d24e388e9dea8716376de9 Mon Sep 17 00:00:00 2001 From: Michael Spang Date: Thu, 16 Nov 2023 09:54:03 -0500 Subject: [PATCH] Add fatal lock tracking support to unlock diagnostic (#30498) It's an error to try to unlock a lock without holding it. Currently we don't have "fatal" lock diagnostics for this error; add this case. --- .../platform/internal/GenericPlatformManagerImpl_POSIX.ipp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp b/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp index ee87cfb7726989..5c50a8dfdaf6ca 100644 --- a/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp +++ b/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp @@ -107,7 +107,10 @@ void GenericPlatformManagerImpl_POSIX::_UnlockChipStack() #if CHIP_STACK_LOCK_TRACKING_ENABLED if (!mChipStackIsLocked) { - ChipLogError(DeviceLayer, "_UnlockChipStack may error status"); + ChipLogError(DeviceLayer, "_UnlockChipStack while unlocked"); +#if CHIP_STACK_LOCK_TRACKING_ERROR_FATAL + chipDie(); +#endif } mChipStackIsLocked = false; #endif