From fb48bd898e9142b5de98512af2255155260865a6 Mon Sep 17 00:00:00 2001 From: Ioannis Damigos Date: Thu, 7 Nov 2024 17:24:28 +0200 Subject: [PATCH] driver/dma_smartbond: Fix driver initialization when PM_DEVICE is set Fix DMA driver initialization when PM_DEVICE is set. Don't put PM policy state lock if it is not active. Signed-off-by: Ioannis Damigos (cherry picked from commit 135214d844c0033ae02686ed645eb8906e8a701d) --- drivers/dma/dma_smartbond.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/dma/dma_smartbond.c b/drivers/dma/dma_smartbond.c index c7ab72dfe34e2..2c474cd203ce4 100644 --- a/drivers/dma/dma_smartbond.c +++ b/drivers/dma/dma_smartbond.c @@ -188,7 +188,9 @@ static inline void dma_smartbond_pm_policy_state_lock_get(void) static inline void dma_smartbond_pm_policy_state_lock_put(void) { #if defined(CONFIG_PM_DEVICE) - pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES); + if (pm_policy_state_lock_is_active(PM_STATE_STANDBY, PM_ALL_SUBSTATES)) { + pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES); + } #endif }