pm: device_runtime: Fix return values

Return 0 in cases where the request does not trigger a device state
change, only incremented or to decremented the reference count.

Fixes #37821

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2021-08-24 16:48:17 -07:00 committed by Anas Nashif
commit 93ae6e930a

View file

@ -109,8 +109,14 @@ static int pm_device_request(const struct device *dev,
if (state == PM_DEVICE_STATE_ACTIVE) {
dev->pm->usage++;
if (dev->pm->usage > 1) {
goto out_unlock;
}
} else {
dev->pm->usage--;
if (dev->pm->usage > 0) {
goto out_unlock;
}
}