Skip to content

Commit

Permalink
soc: nordic: nrf54h: gpd: fix compile warning when CONFIG_DEBUG=y
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
gmarull authored and henrikbrixandersen committed Nov 5, 2024
1 parent 4bb9453 commit 5249619
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions soc/nordic/nrf54h/gpd/gpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,19 @@ static int nrf_gpd_sync(struct gpd_onoff_manager *gpd_mgr)
{
int64_t start;
nrfs_err_t err;
k_spinlock_key_t key;
gdpwr_request_type_t request;

K_SPINLOCK(&gpd_mgr->mgr.lock) {
if (gpd_mgr->mgr.refs == 0) {
request = GDPWR_POWER_REQUEST_CLEAR;
} else {
request = GDPWR_POWER_REQUEST_SET;
}
key = k_spin_lock(&gpd_mgr->mgr.lock);

if (gpd_mgr->mgr.refs == 0) {
request = GDPWR_POWER_REQUEST_CLEAR;
} else {
request = GDPWR_POWER_REQUEST_SET;
}

k_spin_unlock(&gpd_mgr->mgr.lock, key);

atomic_clear_bit(&gpd_service_status, GPD_SERVICE_REQ_ERR);
atomic_clear_bit(&gpd_service_status, GPD_SERVICE_REQ_OK);

Expand Down

0 comments on commit 5249619

Please sign in to comment.