pm_runtime_get_if_active() can return an error including for !CONFIG_PM.
Do not treat that as an active runtime-PM reference.

Fixes: 5a5e9c0228e6 ("accel: Add Arm Ethos-U NPU driver")
Cc: [email protected]
Signed-off-by: Rob Herring (Arm) <[email protected]>
---
v4:
 - new patch
---
 drivers/accel/ethosu/ethosu_perfmon.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/accel/ethosu/ethosu_perfmon.c 
b/drivers/accel/ethosu/ethosu_perfmon.c
index 26f625374f9d..0ae2df3ceac8 100644
--- a/drivers/accel/ethosu/ethosu_perfmon.c
+++ b/drivers/accel/ethosu/ethosu_perfmon.c
@@ -71,7 +71,8 @@ void ethosu_perfmon_stop_locked(struct ethosu_device *ethosu, 
struct ethosu_perf
 
        ncounters = perfmon->ncounters - 1;
 
-       if (!pm_runtime_get_if_active(ethosu->base.dev)) {
+       if (IS_ENABLED(CONFIG_PM) &&
+           pm_runtime_get_if_active(ethosu->base.dev) <= 0) {
                ethosu->perfmon_state.active = NULL;
                return;
        }

-- 
2.53.0

Reply via email to