diff options
author | Johan Hovold <johan@kernel.org> | 2018-12-05 05:21:49 -0500 |
---|---|---|
committer | Johan Hovold <johan@kernel.org> | 2018-12-06 11:22:23 -0500 |
commit | 06fd9ab12b804451b14d538adbf98a57c2d6846b (patch) | |
tree | 47834839ee73b176855ea883e1b586aa61372fb2 /drivers/gnss | |
parent | 2595646791c319cadfdbf271563aac97d0843dc7 (diff) |
gnss: sirf: fix activation retry handling
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: d2efbbd18b1e ("gnss: add driver for sirfstar-based receivers")
Cc: stable <stable@vger.kernel.org> # 4.19
Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/gnss')
-rw-r--r-- | drivers/gnss/sirf.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gnss/sirf.c b/drivers/gnss/sirf.c index 71d014edd167..2c22836d3ffd 100644 --- a/drivers/gnss/sirf.c +++ b/drivers/gnss/sirf.c | |||
@@ -168,7 +168,7 @@ static int sirf_set_active(struct sirf_data *data, bool active) | |||
168 | else | 168 | else |
169 | timeout = SIRF_HIBERNATE_TIMEOUT; | 169 | timeout = SIRF_HIBERNATE_TIMEOUT; |
170 | 170 | ||
171 | while (retries-- > 0) { | 171 | do { |
172 | sirf_pulse_on_off(data); | 172 | sirf_pulse_on_off(data); |
173 | ret = sirf_wait_for_power_state(data, active, timeout); | 173 | ret = sirf_wait_for_power_state(data, active, timeout); |
174 | if (ret < 0) { | 174 | if (ret < 0) { |
@@ -179,9 +179,9 @@ static int sirf_set_active(struct sirf_data *data, bool active) | |||
179 | } | 179 | } |
180 | 180 | ||
181 | break; | 181 | break; |
182 | } | 182 | } while (retries--); |
183 | 183 | ||
184 | if (retries == 0) | 184 | if (retries < 0) |
185 | return -ETIMEDOUT; | 185 | return -ETIMEDOUT; |
186 | 186 | ||
187 | return 0; | 187 | return 0; |