Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp465409lqt; Fri, 19 Apr 2024 00:43:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUFEA0DPTIQqwRnwNkwbt5kJxnOMxB/TyruixxJLnl3b48U1MR4oDTRtHyD17PyiUVcbFRkScNP70EHsn6Og16VdTmN44soG/7I2KHbeQ== X-Google-Smtp-Source: AGHT+IHL6pQY5qE8Xw8G9e8syPwkl+OFVXI3wyHt+uPtc9LwrbO0C8d0WnJcTpmRsv2c8pD6RE9d X-Received: by 2002:a17:90a:53a1:b0:2a2:da08:67db with SMTP id y30-20020a17090a53a100b002a2da0867dbmr6803048pjh.6.1713512639540; Fri, 19 Apr 2024 00:43:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713512639; cv=pass; d=google.com; s=arc-20160816; b=bzUjQyAyfW3WHUiu/1ZbaAI46uOEMOA0EpaR3B75kIskhIVZSiS/hquIhRp9O3C8Sx OkQQbvPbnAgcXrOiuLjqPSRZmaH3s8npSFixUlAHgaTPIH+nYzzeGC01v9gbsKETJ2r8 t7pfk/nCL4yClHYNNDJZLn3Z+SYrrIcCaj42gnp1qUjIKxZo5H+Xdk+pjsTz/7Q/KORQ JadlrqVaM0Gnix/0YWBnLhzF6xgQ+8N6+aONfj4E4P4w+ufJx9GTZk+sxUgO0/MFEQW+ bKZGJFbvmHwRiH1LjxlUTozKIr4XlbWoOTk5Wu/cyvlcIMQ/Zj79644jydZJfz/g80bJ VnJw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id; bh=URGRMsGWGx8jqhA5xtGZg7iC9b/+P8WUOx6u5XW1lAs=; fh=0ZpYi05v942MFUwA4yBodhcpEs+Zh7fMl75aJyHK/XU=; b=w4rTg8EY9vl0kQ6qvdUNyDJ8J3IHKLJ0x+HFuT8x33oiLolaLYg/weieiu8AYXq54V SWjTj9QdizVu2Zbg8Mz3qZjVIjiFRfZY5EGLY6FQcMMOyZZ8uq+6i+CGRHSSvOT08uK1 yZBXYR1oWHAuMr09mT0vBBeSCbPS5kEBXl/hLCHxxy61eE6DpGPkeHUWBvtsClphdRf+ gk21fUX8gfmwm3hPndTZkU/+G7122y4qWeE5hS8IlRQuwnfJ7zCwbBT8gGxLPZvh3m+P uU0R08D14/qYduXm3mW6km8xqBDli120YLglBmfpnfZWokMJDSjLur/N+FgUx/LTcMuX qSbA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-151122-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151122-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u12-20020a63600c000000b005f7c5e8b54asi1261302pgb.451.2024.04.19.00.43.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 00:43:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151122-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-151122-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151122-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 253D4284408 for ; Fri, 19 Apr 2024 07:43:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3BAA47F5F; Fri, 19 Apr 2024 07:43:52 +0000 (UTC) Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C17DC15D; Fri, 19 Apr 2024 07:43:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713512632; cv=none; b=UI9/dL6JqW+fyOmQf4OaSMXotqjq2OefsfltfR58KWlVcWRHuBhJ9w1PXUXo9q0EYZ3ntDw+6CuNKN18WDVQPdt1bdYGZ8AiMtJz9otuDkGygoakPk4YmSHyvl3LBDeUQC70Ga8+BfL5LR0TBjJB6MLHF+8u6Ewt0MjDAfZx8Ko= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713512632; c=relaxed/simple; bh=4hpazauHpk/RFf3gdbIxuFYd45VFPO+t6024y+3xeRM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=b9XzZyqhT3AK6R1ryob2UFyo8AUb1sfedVGMXzCX2t0+Ep+h5mvTkxBwUGATaQ7kjZk9zMtkxv0PbT6xE+k71YdsHb/tCn1eZnkzs0+AvO3vSIHFJwpNbv2++oCf2mQ5yFyJ2jT67OrbsySD4Y5Lb1nSjQ30qdhPbreJ61Hi0d0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a55323f2ef9so203204366b.1; Fri, 19 Apr 2024 00:43:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713512629; x=1714117429; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=URGRMsGWGx8jqhA5xtGZg7iC9b/+P8WUOx6u5XW1lAs=; b=PIcBpL3Ar+Koc9axnZ/D82fw9vIX+bxbjzyncvQXC8jm0OjV1m3x3GpUW45+WkfmqK czaxWvy7oJY5+237Fr7wFWSTnuCf5iByW+8NnsEOjPMe5fj5W5liYM0DE+LHnKET8cSk G2nirvi/4aOU0rNs/ZcHZcfWoZClSekhb/EK6ZBH/DBRvK+hwW2bOmkCD0adblVW/sP2 214m6Ls3mazRyVuSuHaFhF8CD2q98Cw5cEngC9750g6k74wnIa5n9ML8HhzsdchI28GO r70Pz90U1Xg33wpK6nqZasr1pO210Ba/aSZfbA7DHt5HLFleX2C9omyGTlQh4UCDqULs QnKw== X-Forwarded-Encrypted: i=1; AJvYcCVbpAAUZYuAUEuHzbxnVz81EKEFD5yUhAjviJPn2gmgkgDnZW+sV4q2QyMXQzK7zWskZ58ch9xuMYPBhKK1lsavELnYXvd+JsoBdlBihwS2gKrCbP2uVhD8OSU86T7IjPo0yM87bsLq6LWVpQ== X-Gm-Message-State: AOJu0Yx9p/pxw34ymgBTxzoppwHMBfrC23qNu8sV9YGvMtKMFs5bHCnX 0gtqWUUmDZ2OIp4In/XAswHgg0UXQZZanUS2rVD5YZbSBE1on7Kn X-Received: by 2002:a17:906:3d6:b0:a55:a04:6fbc with SMTP id c22-20020a17090603d600b00a550a046fbcmr913858eja.23.1713512628839; Fri, 19 Apr 2024 00:43:48 -0700 (PDT) Received: from ?IPV6:2a0b:e7c0:0:107::aaaa:69? ([2a0b:e7c0:0:107::aaaa:69]) by smtp.gmail.com with ESMTPSA id nb33-20020a1709071ca100b00a55778c1af7sm1457690ejc.11.2024.04.19.00.43.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 19 Apr 2024 00:43:48 -0700 (PDT) Message-ID: <8947962f-e39e-4e96-9d1e-691e40d49349@kernel.org> Date: Fri, 19 Apr 2024 09:43:47 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 11/15] tty: msm_serial: use dmaengine_prep_slave_sg() To: Marek Szyprowski , gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Andersson , Konrad Dybcio , linux-arm-msm@vger.kernel.org, Anders Roxell References: <20240405060826.2521-1-jirislaby@kernel.org> <20240405060826.2521-12-jirislaby@kernel.org> <54679d54-3957-489d-a8b5-b98ea1c8a93c@kernel.org> <0335b679-da36-42c1-a1ba-8affb7a98d44@samsung.com> <783c05cd-0cd2-4b0e-9dce-2a9fdfee7c74@kernel.org> Content-Language: en-US From: Jiri Slaby Autocrypt: addr=jirislaby@kernel.org; keydata= xsFNBE6S54YBEACzzjLwDUbU5elY4GTg/NdotjA0jyyJtYI86wdKraekbNE0bC4zV+ryvH4j rrcDwGs6tFVrAHvdHeIdI07s1iIx5R/ndcHwt4fvI8CL5PzPmn5J+h0WERR5rFprRh6axhOk rSD5CwQl19fm4AJCS6A9GJtOoiLpWn2/IbogPc71jQVrupZYYx51rAaHZ0D2KYK/uhfc6neJ i0WqPlbtIlIrpvWxckucNu6ZwXjFY0f3qIRg3Vqh5QxPkoj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kh7JwmGVrRGNqQrDk+gRNvKnGwFNeTkTKtJ0P8jYd7P1gZb9Fwj9YLx jhn/sVIhNmEBLBoI7PL+9fbILqJPHgAwW35rpnq4f/EYTykbk1sa13Tav6btJ+4QOgbcezWI wZ5w/JVfEJW9JXp3BFAVzRQ5nVrrLDAJZ8Y5ioWcm99JtSIIxXxt9FJaGc1Bgsi5K/+dyTKL wLMJgiBzbVx8G+fCJJ9YtlNOPWhbKPlrQ8+AY52Aagi9WNhe6XfJdh5g6ptiOILm330mkR4g W6nEgZVyIyTq3ekOuruftWL99qpP5zi+eNrMmLRQx9iecDNgFr342R9bTDlb1TLuRb+/tJ98 f/bIWIr0cqQmqQ33FgRhrG1+Xml6UXyJ2jExmlO8JljuOGeXYh6ZkIEyzqzffzBLXZCujlYQ DFXpyMNVJ2ZwPmX2mWEoYuaBU0JN7wM+/zWgOf2zRwhEuD3A2cO2PxoiIfyUEfB9SSmffaK/ S4xXoB6wvGENZ85Hg37C7WDNdaAt6Xh2uQIly5grkgvWppkNy4ZHxE+jeNsU7tg= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 17. 04. 24, 14:45, Marek Szyprowski wrote: > I alse tried to change the "if (dma->mapped)" check in msm_start_tx() to: > > 1. if (dma->tx_sg.length) > > 2. if (dma->tx_sg.page_link & ~SG_PAGE_LINK_MASK) > > but none of the above worked what is really strange and incomprehensible > for me. > Aaaah, nevermind, what about this? Two bugs: 1) dma_map_sg() returns the number of mapped entries. Not zero! 2) And I forgot to zero tx_sg in case of error. --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c @@ -506,8 +506,8 @@ static int msm_handle_tx_dma(struct msm_port *msm_port, unsigned int count) kfifo_dma_out_prepare(&tport->xmit_fifo, &dma->tx_sg, 1, count); ret = dma_map_sg(port->dev, &dma->tx_sg, 1, dma->dir); - if (ret) - return ret; + if (!ret) + goto zero_out; dma->desc = dmaengine_prep_slave_sg(dma->chan, &dma->tx_sg, 1, DMA_MEM_TO_DEV, @@ -548,6 +548,7 @@ static int msm_handle_tx_dma(struct msm_port *msm_port, unsigned int count) return 0; unmap: dma_unmap_sg(port->dev, &dma->tx_sg, 1, dma->dir); +zero_out: sg_init_table(&dma->tx_sg, 1); return ret; } thanks, -- js suse labs