linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Wolfram Sang <wsa@the-dreams.de>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 4.14 19/19] i2c: rcar: cleanup DMA for all kinds of failure
Date: Tue, 30 Oct 2018 09:28:24 -0400	[thread overview]
Message-ID: <20181030132824.218056-19-sashal@kernel.org> (raw)
In-Reply-To: <20181030132824.218056-1-sashal@kernel.org>

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

[ Upstream commit 31d86033a0749a0463ea654130b2de5c163154f1 ]

DMA needs to be cleaned up not only on timeout, but on all errors where
it has been setup before.

Fixes: 73e8b0528346 ("i2c: rcar: add DMA support")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/i2c/busses/i2c-rcar.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 7f044df1ea07..3415733a9364 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -761,8 +761,12 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
 
 	time_left = wait_event_timeout(priv->wait, priv->flags & ID_DONE,
 				     num * adap->timeout);
-	if (!time_left) {
+
+	/* cleanup DMA if it couldn't complete properly due to an error */
+	if (priv->dma_direction != DMA_NONE)
 		rcar_i2c_cleanup_dma(priv);
+
+	if (!time_left) {
 		rcar_i2c_init(priv);
 		ret = -ETIMEDOUT;
 	} else if (priv->flags & ID_NACK) {
-- 
2.17.1


      parent reply	other threads:[~2018-10-30 13:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-30 13:28 [PATCH AUTOSEL 4.14 01/19] bpf: do not blindly change rlimit in reuseport net selftest Sasha Levin
2018-10-30 13:28 ` [PATCH AUTOSEL 4.14 02/19] Revert "perf tools: Fix PMU term format max value calculation" Sasha Levin
2018-10-30 13:28 ` [PATCH AUTOSEL 4.14 03/19] net/mlx5: Take only bit 24-26 of wqe.pftype_wq for page fault type Sasha Levin
2018-10-30 13:28 ` [PATCH AUTOSEL 4.14 04/19] xfrm: policy: use hlist rcu variants on insert Sasha Levin
2018-10-30 13:28 ` [PATCH AUTOSEL 4.14 05/19] perf vendor events intel: Fix wrong filter_band* values for uncore events Sasha Levin
2018-10-30 13:28 ` [PATCH AUTOSEL 4.14 06/19] sparc: Fix single-pcr perf event counter management Sasha Levin
2018-10-30 13:28 ` [PATCH AUTOSEL 4.14 07/19] sparc: Throttle perf events properly Sasha Levin
2018-10-30 13:28 ` [PATCH AUTOSEL 4.14 08/19] sparc64: Make proc_id signed Sasha Levin
2018-10-30 13:28 ` [PATCH AUTOSEL 4.14 09/19] net: fec: don't dump RX FIFO register when not available Sasha Levin
2018-10-30 13:28 ` [PATCH AUTOSEL 4.14 10/19] sched/fair: Fix the min_vruntime update logic in dequeue_entity() Sasha Levin
2018-10-30 13:28 ` [PATCH AUTOSEL 4.14 11/19] perf tools: Fix use of alternatives to find JDIR Sasha Levin
2018-10-30 13:28 ` [PATCH AUTOSEL 4.14 12/19] perf cpu_map: Align cpu map synthesized events properly Sasha Levin
2018-10-30 13:28 ` [PATCH AUTOSEL 4.14 13/19] x86/fpu: Remove second definition of fpu in __fpu__restore_sig() Sasha Levin
2018-10-30 13:28 ` [PATCH AUTOSEL 4.14 14/19] net: qla3xxx: Remove overflowing shift statement Sasha Levin
2018-10-30 13:28 ` [PATCH AUTOSEL 4.14 15/19] virtio_net: avoid using netif_tx_disable() for serializing tx routine Sasha Levin
2018-10-30 13:28 ` [PATCH AUTOSEL 4.14 16/19] r8169: fix NAPI handling under high load Sasha Levin
2018-10-30 13:28 ` [PATCH AUTOSEL 4.14 17/19] selftests: ftrace: Add synthetic event syntax testcase Sasha Levin
2018-10-30 14:58   ` Steven Rostedt
2018-10-30 18:21     ` Sasha Levin
2018-11-01 17:34       ` Masami Hiramatsu
2018-10-30 13:28 ` [PATCH AUTOSEL 4.14 18/19] net: fix pskb_trim_rcsum_slow() with odd trim offset Sasha Levin
2018-10-30 13:28 ` Sasha Levin [this message]

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=20181030132824.218056-19-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=wsa@the-dreams.de \
    /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).