Skip to content

Commit 39fe351

Browse files
retention: skip mutex lock/unlock when in pre-kernel
Skip the mutex locking/unlocking when called during pre-kernel. Signed-off-by: Henrik Brix Andersen <[email protected]>
1 parent 4ef1163 commit 39fe351

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

subsys/retention/retention.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ static inline void retention_lock_take(const struct device *dev)
6363
#ifdef CONFIG_RETENTION_MUTEXES
6464
struct retention_data *data = dev->data;
6565

66-
k_mutex_lock(&data->lock, K_FOREVER);
66+
if (!k_is_pre_kernel()) {
67+
k_mutex_lock(&data->lock, K_FOREVER);
68+
}
6769
#else
6870
ARG_UNUSED(dev);
6971
#endif
@@ -74,7 +76,9 @@ static inline void retention_lock_release(const struct device *dev)
7476
#ifdef CONFIG_RETENTION_MUTEXES
7577
struct retention_data *data = dev->data;
7678

77-
k_mutex_unlock(&data->lock);
79+
if (!k_is_pre_kernel()) {
80+
k_mutex_unlock(&data->lock);
81+
}
7882
#else
7983
ARG_UNUSED(dev);
8084
#endif

0 commit comments

Comments
 (0)