Skip to content

Commit

Permalink
gnss: sirf: fix activation retry handling
Browse files Browse the repository at this point in the history
Fix activation helper which would return -ETIMEDOUT even if the last
retry attempt was successful.

Also change the semantics of the retries variable so that it actually
holds the number of retries (rather than tries).

Fixes: d2efbbd ("gnss: add driver for sirfstar-based receivers")
Cc: stable <[email protected]>	# 4.19
Signed-off-by: Johan Hovold <[email protected]>
  • Loading branch information
jhovold committed Dec 6, 2018
1 parent 2595646 commit 06fd9ab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/gnss/sirf.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ static int sirf_set_active(struct sirf_data *data, bool active)
else
timeout = SIRF_HIBERNATE_TIMEOUT;

while (retries-- > 0) {
do {
sirf_pulse_on_off(data);
ret = sirf_wait_for_power_state(data, active, timeout);
if (ret < 0) {
Expand All @@ -179,9 +179,9 @@ static int sirf_set_active(struct sirf_data *data, bool active)
}

break;
}
} while (retries--);

if (retries == 0)
if (retries < 0)
return -ETIMEDOUT;

return 0;
Expand Down

0 comments on commit 06fd9ab

Please sign in to comment.