Skip to content

Commit

Permalink
[nrf fromtree] soc: nordic: nrf54h: gpd: fix compile warning when CON…
Browse files Browse the repository at this point in the history
…FIG_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)
  • Loading branch information
gmarull committed Nov 6, 2024
1 parent 7037a6f commit 14fbad3
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 @@ -93,16 +93,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 14fbad3

Please sign in to comment.