Skip to content

Commit 5249619

Browse files
gmarullhenrikbrixandersen
authored andcommitted
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 <gerard@teslabs.com>
1 parent 4bb9453 commit 5249619

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
@@ -66,16 +66,19 @@ static int nrf_gpd_sync(struct gpd_onoff_manager *gpd_mgr)
6666
{
6767
int64_t start;
6868
nrfs_err_t err;
69+
k_spinlock_key_t key;
6970
gdpwr_request_type_t request;
7071

71-
K_SPINLOCK(&gpd_mgr->mgr.lock) {
72-
if (gpd_mgr->mgr.refs == 0) {
73-
request = GDPWR_POWER_REQUEST_CLEAR;
74-
} else {
75-
request = GDPWR_POWER_REQUEST_SET;
76-
}
72+
key = k_spin_lock(&gpd_mgr->mgr.lock);
73+
74+
if (gpd_mgr->mgr.refs == 0) {
75+
request = GDPWR_POWER_REQUEST_CLEAR;
76+
} else {
77+
request = GDPWR_POWER_REQUEST_SET;
7778
}
7879

80+
k_spin_unlock(&gpd_mgr->mgr.lock, key);
81+
7982
atomic_clear_bit(&gpd_service_status, GPD_SERVICE_REQ_ERR);
8083
atomic_clear_bit(&gpd_service_status, GPD_SERVICE_REQ_OK);
8184

0 commit comments

Comments
 (0)