linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Alex Elder <elder@linaro.org>,
	"David S . Miller" <davem@davemloft.net>,
	Sasha Levin <sashal@kernel.org>,
	netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.4 07/14] net: ipa: fix a bug in ipa_endpoint_stop()
Date: Thu, 14 May 2020 14:56:18 -0400	[thread overview]
Message-ID: <20200514185625.21753-7-sashal@kernel.org> (raw)
In-Reply-To: <20200514185625.21753-1-sashal@kernel.org>

From: Alex Elder <elder@linaro.org>

[ Upstream commit 713b6ebb4c376b3fb65fdceb3b59e401c93248f9 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ipa/ipa_endpoint.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c
index 915b4cd05dd29..78ed431e6eb86 100644
--- a/drivers/net/ipa/ipa_endpoint.c
+++ b/drivers/net/ipa/ipa_endpoint.c
@@ -1284,7 +1284,7 @@ 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 {
@@ -1292,12 +1292,9 @@ int ipa_endpoint_stop(struct ipa_endpoint *endpoint)
 		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);
-- 
2.20.1


  parent reply	other threads:[~2020-05-14 18:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14 18:56 [PATCH AUTOSEL 4.4 01/14] Makefile: disallow data races on gcc-10 as well Sasha Levin
2020-05-14 18:56 ` [PATCH AUTOSEL 4.4 02/14] HID: multitouch: add eGalaxTouch P80H84 support Sasha Levin
2020-05-14 18:56 ` [PATCH AUTOSEL 4.4 03/14] batman-adv: fix batadv_nc_random_weight_tq Sasha Levin
2020-05-14 18:56 ` [PATCH AUTOSEL 4.4 04/14] net/sonic: Fix a resource leak in an error handling path in 'jazz_sonic_probe()' Sasha Levin
2020-05-14 18:56 ` [PATCH AUTOSEL 4.4 05/14] dp83640: reverse arguments to list_add_tail Sasha Levin
2020-05-14 18:56 ` [PATCH AUTOSEL 4.4 06/14] soc: qcom: ipa: IPA endpoints Sasha Levin
2020-05-14 18:56 ` Sasha Levin [this message]
2020-05-14 18:56 ` [PATCH AUTOSEL 4.4 08/14] net: moxa: Fix a potential double 'free_irq()' Sasha Levin
2020-05-14 18:56 ` [PATCH AUTOSEL 4.4 09/14] ceph: fix double unlock in handle_cap_export() Sasha Levin
2020-05-14 18:56 ` [PATCH AUTOSEL 4.4 10/14] net/mlx4_core: Fix use of ENOSPC around mlx4_counter_alloc() Sasha Levin
2020-05-14 18:56 ` [PATCH AUTOSEL 4.4 11/14] USB: core: Fix misleading driver bug report Sasha Levin
2020-05-14 18:56 ` [PATCH AUTOSEL 4.4 12/14] platform/x86: asus-nb-wmi: Do not load on Asus T100TA and T200TA Sasha Levin
2020-05-14 18:56 ` [PATCH AUTOSEL 4.4 13/14] ARM: futex: Address build warning Sasha Levin
2020-05-14 18:56 ` [PATCH AUTOSEL 4.4 14/14] scripts/decodecode: fix trapping instruction formatting Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200514185625.21753-7-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=davem@davemloft.net \
    --cc=elder@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).