提交 3c1773b0 编写于 作者: J Johan Hovold 提交者: Greg Kroah-Hartman

gnss: sirf: fix activation retry handling

commit 06fd9ab1 upstream.

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: d2efbbd1 ("gnss: add driver for sirfstar-based receivers")
Cc: stable <stable@vger.kernel.org>	# 4.19
Signed-off-by: NJohan Hovold <johan@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 41867ab9
...@@ -168,7 +168,7 @@ static int sirf_set_active(struct sirf_data *data, bool active) ...@@ -168,7 +168,7 @@ static int sirf_set_active(struct sirf_data *data, bool active)
else else
timeout = SIRF_HIBERNATE_TIMEOUT; timeout = SIRF_HIBERNATE_TIMEOUT;
while (retries-- > 0) { do {
sirf_pulse_on_off(data); sirf_pulse_on_off(data);
ret = sirf_wait_for_power_state(data, active, timeout); ret = sirf_wait_for_power_state(data, active, timeout);
if (ret < 0) { if (ret < 0) {
...@@ -179,9 +179,9 @@ static int sirf_set_active(struct sirf_data *data, bool active) ...@@ -179,9 +179,9 @@ static int sirf_set_active(struct sirf_data *data, bool active)
} }
break; break;
} } while (retries--);
if (retries == 0) if (retries < 0)
return -ETIMEDOUT; return -ETIMEDOUT;
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册