Skip to content

Commit

Permalink
net: ipa: fix a bug in ipa_endpoint_stop()
Browse files Browse the repository at this point in the history
In ipa_endpoint_stop(), for TX endpoints we set the number of retries
to 0.  When we break out of the loop, retries being 0 means we return
EIO rather than the value of ret (which should be 0).

Fix this by using a non-zero retry count for both RX and TX
channels, and just break out of the loop after calling
gsi_channel_stop() for TX channels.  This way only RX channels
will retry, and the retry count will be non-zero at the end
for TX channels (so the proper value gets returned).

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 713b6eb)
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Alex Elder authored and David S. Miller committed May 7, 2020
1 parent 6a5dc76 commit 97e4692
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/net/ipa/ipa_endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -1311,20 +1311,17 @@ static int ipa_endpoint_stop_rx_dma(struct ipa *ipa)
*/
int ipa_endpoint_stop(struct ipa_endpoint *endpoint)
{
u32 retries = endpoint->toward_ipa ? 0 : IPA_ENDPOINT_STOP_RX_RETRIES;
u32 retries = IPA_ENDPOINT_STOP_RX_RETRIES;
int ret;

do {
struct ipa *ipa = endpoint->ipa;
struct gsi *gsi = &ipa->gsi;

ret = gsi_channel_stop(gsi, endpoint->channel_id);
if (ret != -EAGAIN)
if (ret != -EAGAIN || endpoint->toward_ipa)
break;

if (endpoint->toward_ipa)
continue;

/* For IPA v3.5.1, send a DMA read task and check again */
if (ipa->version == IPA_VERSION_3_5_1) {
ret = ipa_endpoint_stop_rx_dma(ipa);
Expand Down

0 comments on commit 97e4692

Please sign in to comment.