Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp831216ybl; Wed, 11 Dec 2019 08:09:37 -0800 (PST) X-Google-Smtp-Source: APXvYqzKg1ry8ywrBM7tJglSpGtpLLo7+82vM/lCLwiK+FaSTM9KjlWvP4LKOd0zmHWOnvEaqDnX X-Received: by 2002:a54:4817:: with SMTP id j23mr3203913oij.152.1576080577718; Wed, 11 Dec 2019 08:09:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576080577; cv=none; d=google.com; s=arc-20160816; b=dd+zJFGJtvCsPdH6htmTRZY1RloUqmcsgwHlOnIBKaOYFKYn4AoUsrtB03F+SycDUa HZ49SGVjo3c0SNnsjlZl+Yt71F8ylMsXCKSpx1ctzRzPaNxxsPAI786lDb0jvEM8mUWS 920HiI90RG40MiprqeL4C56qmshCfmRsBFP9ppK+LWLD9ML7LbI8gnmICYvLKBmplxbU bScSZvNdh43XiUDpwkV1uX4moGEul9iXS71pkMu8ba+kUO04kVdFYahct/h4RZgfvX5m 9VmRiMRZo6rjmF5n3WAdXcDuQ84ATsUPRnHVqPMkMHZOSLtIXfqhXjAROh/ioS3yVM9C imsA== 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=Xjt9oW0foeXgG8TrS7i+hHoynGiMqfZe2bw2ETIfkPY=; b=eLmfFZn4E/agv+BME9uBwbVdqyLWNkFLdDkIq3+9kNYbzDMnM1VxoJheF7+qkRR9sn 6doFKhhK4QaJk14jROqGRsjcAkcj85QwkH75zYSOTvgFF6bxqBl6SLYLN11VjxmVy279 hVi5uLRnnUJD8I13yun1bpKk3yZ9qjYXiWi0nPYF9C/qhxaMLYFr8vMrOBmDJvquRKEl 9JPbBZ7jQ1le/PYIhMG6gogF61ibd4BrkrldlvFLzU/AKR0qxrKz5xKrnqYBoL3vspdi SXVDqvi+AgeTpMUrSwt/tbK0LDmpAKkE8IguNuMtBaAadN7Dx0KHjSkUqOcgayf7lJO7 ixuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RWWKtOCW; 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 u186si1382634oig.29.2019.12.11.08.09.26; Wed, 11 Dec 2019 08:09:37 -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=RWWKtOCW; 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 S1731074AbfLKPMO (ORCPT + 99 others); Wed, 11 Dec 2019 10:12:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:32890 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730468AbfLKPME (ORCPT ); Wed, 11 Dec 2019 10:12:04 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 3293B22B48; Wed, 11 Dec 2019 15:12:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077123; bh=y8mpjC+u8Jx70mOl50vaZHKS1XoR4ZEnZ1BHSjzhT8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RWWKtOCWdE3TNWQkve3adnG2xOYrLHbWmQXEPfkvzyGRyy5MVQAzu1RP2ZlpYInV0 O6ywEscbJCsed6y+bUQG3CYl9NQ5eK0nVg89TL0IKxowDlGIalJr6/BrZP3f9l7B6b 1Vy+GdPPOweSK4liub+bWTYPmCa7sxAOJfLs+S+0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Fan Subject: [PATCH 5.3 008/105] tty: serial: fsl_lpuart: use the sg count from dma_map_sg Date: Wed, 11 Dec 2019 16:04:57 +0100 Message-Id: <20191211150223.274323449@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.153659747@linuxfoundation.org> References: <20191211150221.153659747@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Peng Fan commit 487ee861de176090b055eba5b252b56a3b9973d6 upstream. The dmaengine_prep_slave_sg needs to use sg count returned by dma_map_sg, not use sport->dma_tx_nents, because the return value of dma_map_sg is not always same with "nents". When enabling iommu for lpuart + edma, iommu framework may concatenate two sgs into one. Fixes: 6250cc30c4c4e ("tty: serial: fsl_lpuart: Use scatter/gather DMA for Tx") Cc: Signed-off-by: Peng Fan Link: https://lore.kernel.org/r/1572932977-17866-1-git-send-email-peng.fan@nxp.com Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/fsl_lpuart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -436,8 +436,8 @@ static void lpuart_dma_tx(struct lpuart_ } sport->dma_tx_desc = dmaengine_prep_slave_sg(sport->dma_tx_chan, sgl, - sport->dma_tx_nents, - DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT); + ret, DMA_MEM_TO_DEV, + DMA_PREP_INTERRUPT); if (!sport->dma_tx_desc) { dma_unmap_sg(dev, sgl, sport->dma_tx_nents, DMA_TO_DEVICE); dev_err(dev, "Cannot prepare TX slave DMA!\n");