Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3440452imu; Sun, 11 Nov 2018 15:09:03 -0800 (PST) X-Google-Smtp-Source: AJdET5dP+6LLtBheCtOGWl12QXXuRzWunN87rt3SAyNNbhIvDGPNzytm6oNJK7dREOxot2sQ98Jw X-Received: by 2002:a63:6150:: with SMTP id v77mr15164594pgb.266.1541977743203; Sun, 11 Nov 2018 15:09:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541977743; cv=none; d=google.com; s=arc-20160816; b=qeKfRBXjwjLrLwLNYsAmua+XGiVWrgVdtTSnrPTY30WFXDH0zRiVD+IGiz0QlFW/0E x7oT2G+7lhx+7W8yLHInKFGS/N6vX2IEpzGyCHmVrmUlf3V3A3Qwqany+m8Traque5ic Lbcgf6d1Ma9kXZGpcJ72orlL9zEicb8U93qm4/+Fhb6Wcni7RKPKgfNvT1yvq93NJJBe 5n/LVWXbheRglj3ob7yD24LhzpLaqJXQnTpoBYIDRQtE+VOO8zoV/sJ2MWbjNmtmo1Cw IvcVDuyt8Pbwx786yBV3iEnZVsBCVYEfPhnGOkmLjxGx0OLGwYZ9T7fgR1HHZ6NnImG6 lyKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1ac9CmUgZWGWwo9HuL6OWzK3lKaq2CZ//rXl6j+9QaU=; b=xx1ZK8ci1RrYPlXIrmE0PFYEbF31xZL5y0NnbMABxD6Qbpqb9Zs8gbKc/2fU0QihnE InsMpybjwqxlqt8wbD2yCii5KNsdp2KBbY7kKP46rsuW9NT5JNkx686J2yHxYo7VFESK +Aot5ic/kJ74ZchP7jw2VWoFpmxS339r126RnmPgHBpTgDLtpEO+QelJSHay8xvB1MST wDMM5fixmBJ/v1BN/OqFSuEsXVTED1qUTV/IA8BCscgZhj2AienCBmvNdQz+B4O1etlt Y94Zzz3ziBseLEr9ZsR4K2+cnCZjsTjYOe+vcDmbtwxwQLiseQ+5aeMhkfkbglxReacp 0U5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ihKv9+MO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e9si1247947plt.330.2018.11.11.15.08.48; Sun, 11 Nov 2018 15:09:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ihKv9+MO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390332AbeKLIWK (ORCPT + 99 others); Mon, 12 Nov 2018 03:22:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:51248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390245AbeKLIWH (ORCPT ); Mon, 12 Nov 2018 03:22:07 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 94702223C8; Sun, 11 Nov 2018 22:32:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975530; bh=AG6h5zSFbcjVBfaMNTh3VKVAqzfnWFKll207RYq0Npo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ihKv9+MOhspnBXvfXhiQk3DrixIKIFjkNPZ4s65jefKDTAdqyEgXhi9fam2i4CunB pBaPon6/RhHAStCgUf9uQ19vnzryjtWTdsEacyCc+sxdffD6CdXceElAO6e6wVuVrg gRZE8awDhWUhidxXdmVj/gO20HqejU+3WZ2X3X20= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wolfram Sang , Wolfram Sang , Sasha Levin Subject: [PATCH 4.14 038/222] i2c: rcar: cleanup DMA for all kinds of failure Date: Sun, 11 Nov 2018 14:22:15 -0800 Message-Id: <20181111221651.602721513@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wolfram Sang [ 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 Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-rcar.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- 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 i 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) {