Skip to content

Commit 7272d7f

Browse files
committed
[nrf fromtree] soc: nordic: nrf54h: gpd: fix compile warning when CONFIG_DEBUG=y
Usage of K_SPINLOCK with CONFIG_DEBUG=y seems to trigger a compiler warning about request not always being initialized. Fallback to k_spin_lock/unlock calls to fix this issue. Signed-off-by: Gerard Marull-Paretas <[email protected]> (cherry picked from commit 5249619)
1 parent 5c46864 commit 7272d7f

File tree

1 file changed

+9
-6
lines changed
  • soc/nordic/nrf54h/gpd

1 file changed

+9
-6
lines changed

soc/nordic/nrf54h/gpd/gpd.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,19 @@ static int nrf_gpd_sync(struct gpd_onoff_manager *gpd_mgr)
9393
{
9494
int64_t start;
9595
nrfs_err_t err;
96+
k_spinlock_key_t key;
9697
gdpwr_request_type_t request;
9798

98-
K_SPINLOCK(&gpd_mgr->mgr.lock) {
99-
if (gpd_mgr->mgr.refs == 0) {
100-
request = GDPWR_POWER_REQUEST_CLEAR;
101-
} else {
102-
request = GDPWR_POWER_REQUEST_SET;
103-
}
99+
key = k_spin_lock(&gpd_mgr->mgr.lock);
100+
101+
if (gpd_mgr->mgr.refs == 0) {
102+
request = GDPWR_POWER_REQUEST_CLEAR;
103+
} else {
104+
request = GDPWR_POWER_REQUEST_SET;
104105
}
105106

107+
k_spin_unlock(&gpd_mgr->mgr.lock, key);
108+
106109
atomic_clear_bit(&gpd_service_status, GPD_SERVICE_REQ_ERR);
107110
atomic_clear_bit(&gpd_service_status, GPD_SERVICE_REQ_OK);
108111

0 commit comments

Comments
 (0)