Received: by 10.192.165.148 with SMTP id m20csp3563347imm; Mon, 7 May 2018 14:37:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo3CBLhk8m2Z694P10Qe+/Dy/YWN4U5vkryrKH8QxNG+sccm94JiOtJQLzs/L+kWNFZTJ1d X-Received: by 10.98.89.89 with SMTP id n86mr36309117pfb.217.1525729028300; Mon, 07 May 2018 14:37:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525729028; cv=none; d=google.com; s=arc-20160816; b=L+M64QHwyxFRTFXhw3RVGKLOABU7iXzGnF2IXgOK7WKoxOW5AvR+oAXJYHDA2+tN/p p799sSnVUDKEeEloUAtziy3XkEeZhwG+JlLIt3Xl/7L5F/V5OKxOlLsZ64ekC3eZqYeb uNcR3b4tr6kC5Ji/3NGqqIEgkxNK8ppisDSuzcSrM/9+kgra/I3xsYVJwr92VTbh8t3h j2cF3A+FeINhek2u1JONcFZhFXtCkC4YeXh7JwIzIVlbjFqcYvs/Eg2HnzeWT2174cQa NaZTSkdiqsLhom+NvSlWt5cXy+nLtHg0FGvGkkCF0AZYxlpCGijCoX+NKhMF2jNx4Ina tsvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=ESUwtMDvdu30cqxu20QUVgIHLmxMZ5BvUV5m9MvsrHw=; b=frdcInTI6b5NGrA4lTm8toxtDjHs2NOyFll0115u9rC8muDyrIqCGtnHrdKktVEHCU +XLO696w5zeke7h3swsMXKNCNRjWMda8GZmuiXcW0ou2y8/8/wr8eZ01RnDTqlSnXmaZ wYWKbJeTx4bVUT/1AWUwZxyiIhEWERdFMAYR0X68rrQtQBzCnZrC09803xcLw0jUSdJ5 Xg710vtAWzuhhjI2BwusD24aBfM/4UdJN12/VgjnKqeA98L5vW1aPCAo+gAenxt5mCbh 5QtmN2hxEE5DkqN/UiO9zxoXj1uhVkZY1IadWr3/SRU5VcxCpHssm4ZlG/TUrvesXojT b7Lw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.co.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x7-v6si18635727pgx.83.2018.05.07.14.36.53; Mon, 07 May 2018 14:37:08 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.co.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753322AbeEGVgX (ORCPT + 99 others); Mon, 7 May 2018 17:36:23 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:43716 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752726AbeEGVgT (ORCPT ); Mon, 7 May 2018 17:36:19 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id 1883A261218 From: Sebastian Reichel To: Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org Cc: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Fabio Estevam , Shawn Guo , linux-kernel@vger.kernel.org, Sebastian Reichel Subject: [PATCH 2/2] serial: imx: dma_unmap_sg buffers on shutdown Date: Mon, 7 May 2018 23:36:10 +0200 Message-Id: <20180507213610.17330-3-sebastian.reichel@collabora.co.uk> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180507213610.17330-1-sebastian.reichel@collabora.co.uk> References: <20180507213610.17330-1-sebastian.reichel@collabora.co.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This properly unmaps DMA SG on device shutdown. Reported-by: Nandor Han Suggested-by: Nandor Han Signed-off-by: Sebastian Reichel --- drivers/tty/serial/imx.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 3ca767b1162a..6c53e74244ec 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1425,10 +1425,18 @@ static void imx_uart_shutdown(struct uart_port *port) u32 ucr1, ucr2; if (sport->dma_is_enabled) { - sport->dma_is_rxing = 0; - sport->dma_is_txing = 0; dmaengine_terminate_sync(sport->dma_chan_tx); + if (sport->dma_is_txing) { + dma_unmap_sg(sport->port.dev, &sport->tx_sgl[0], + sport->dma_tx_nents, DMA_TO_DEVICE); + sport->dma_is_txing = 0; + } dmaengine_terminate_sync(sport->dma_chan_rx); + if (sport->dma_is_rxing) { + dma_unmap_sg(sport->port.dev, &sport->rx_sgl, + 1, DMA_FROM_DEVICE); + sport->dma_is_rxing = 0; + } spin_lock_irqsave(&sport->port.lock, flags); imx_uart_stop_tx(port); -- 2.17.0