Skip to content

Commit

Permalink
pm: device_runtime: Fix bitfields misuse
Browse files Browse the repository at this point in the history
PM_DEVICE_FLAG_ISR_SAFE is an enum and it must be converted to
a bit mask before masking with flags.

Signed-off-by: Krzysztof Chruściński <[email protected]>
(cherry picked from commit 581c554)
  • Loading branch information
nordic-krch authored and nashif committed Jan 24, 2025
1 parent afdd87e commit 4ef146d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions subsys/pm/device_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ static int get_sync_locked(const struct device *dev)
if (flags & BIT(PM_DEVICE_FLAG_PD_CLAIMED)) {
const struct device *domain = PM_DOMAIN(&pm->base);

if (domain->pm_base->flags & PM_DEVICE_FLAG_ISR_SAFE) {
if (domain->pm_base->flags & BIT(PM_DEVICE_FLAG_ISR_SAFE)) {
ret = pm_device_runtime_get(domain);
if (ret < 0) {
return ret;
Expand Down Expand Up @@ -300,7 +300,7 @@ static int put_sync_locked(const struct device *dev)
if (flags & BIT(PM_DEVICE_FLAG_PD_CLAIMED)) {
const struct device *domain = PM_DOMAIN(&pm->base);

if (domain->pm_base->flags & PM_DEVICE_FLAG_ISR_SAFE) {
if (domain->pm_base->flags & BIT(PM_DEVICE_FLAG_ISR_SAFE)) {
ret = put_sync_locked(domain);
} else {
ret = -EWOULDBLOCK;
Expand Down

0 comments on commit 4ef146d

Please sign in to comment.