Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp468757lqt; Fri, 19 Apr 2024 00:53:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUZ0aQKQcX+RTnFt0JRLLZyxj08wtQj4nIQlulacGipStKvNcoQDiEs4rT9zYYj6YgUt12T/ZZqQY3A1/ZJuNOhZDgJ2fQGXJOnoqKhdA== X-Google-Smtp-Source: AGHT+IEe7hdsaN0j0c37D8Ulay/K9DOGWr03314m89NemPh+NH8XpOZLzGDbI1SLQ6TVnqjuMMoC X-Received: by 2002:a05:6870:295:b0:239:43b3:23a9 with SMTP id q21-20020a056870029500b0023943b323a9mr1484602oaf.15.1713513200029; Fri, 19 Apr 2024 00:53:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713513199; cv=pass; d=google.com; s=arc-20160816; b=psJexHIhUO4pWQ0XoIJbFhcFjW/dycYktkWi9FxAbBrs10Wxuxx5LlCj6fav65/LrX +CD2YI6/8gCzaHe5GdpxZ+7nsdb4WFYKTXOB7gquWBHL2nvk2KWiPn11Bb+I4zPQUtpo GRXG2Ps/N0p5rWwhDCCYWIyuz32rWcIMmjLbVJpX+9fDzyZyFkTOi7lOWl/EjU2ZYzlE H728xnCmXULh1bmQGgwkjd+jIL4z14cGsyr/AsU8MWfA0WBqOziB6ryLORaCkvghnf3x nBwWpqKPK6JrAfz3mqOwc1RVTlhoLY4eAoGVq6wWfpNbX1GBmww2u32GfjuUSNVojD5R JRow== 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:content-language :references:cc:to:from:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id; bh=dkg2PsPWwQuUQlT1wRqaFRT1C3anmOX1PDdZQuQBq4k=; fh=sRmmJod96XzDDNvtnEU2xzYfER8GgvzrBR0iKnFJC8I=; b=VJdeUpoqgx63mlfkRh3lhGY24cD7tO6ZVuMXkykjKXvVnWphDoWkqoFPDDzVLJ66Em pWPWZ942MUtMB0dktr6oXA5aUF1EmoGEnsQTDOxeeA24HyZHWjKDIBr2BeMMenf5L1ZO Nb+g1MRfdvZp/8yF6EKg6DLc6Go89BkD1FR2qKgKp5cyesAxLq7nQX3KWvD/CFEPdLhd z7WZll/g7sx+oEnNMdNb+opNjFjvFc8eq6nfcUDd7G4edOstOaIPzVrD4BkAPDNUjelx GCTF3mHxk3wki1HnDafT5xSI1hIr63UII+osvorwE0OQ66MER8GdS74T9i20Y5uB4J82 h7ag==; 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-151135-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151135-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y7-20020a63de47000000b005e49d9ecdcasi2735200pgi.741.2024.04.19.00.53.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 00:53:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151135-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-151135-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151135-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 9916D2827B0 for ; Fri, 19 Apr 2024 07:53:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 58E244AEED; Fri, 19 Apr 2024 07:53:11 +0000 (UTC) Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (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 377972AF16; Fri, 19 Apr 2024 07:53:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713513190; cv=none; b=c7cHG49EHJkvTKpYGoMJ8QfKulqx/hJmame0vfIjmsOQ4VfkLyV4pY9CAy0uCEGfHOoroOrMBv6SApUrFnSLHob4YU3Dt7GWQsnRtzgKayQeVlsG5Dop5uSguv8/S84hDkB8CnQ/bnBS3vwPjsKBLtHoTAlMbXCmqpfq31qwZAI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713513190; c=relaxed/simple; bh=q/5APZuZ3d+HFuI6lhPu++jsp67VUOCrWPJcpMnETSM=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=WZAjA9jAdPr1Q4fmANPsU4huKXAyevvlfGBn23goKxO2c5CMplZoPlE+69mMprEmo2RGi9mLrf7QIMwZ4XjsgGibj3oB844mKpLPJyz92sc3n8D4bue1wEmFLYD4khfFUDgWYTHUk4PNetLIzvfvxNQCtHYLgENx2oGRD4tVjMs= 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.208.49 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-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-56e6affdd21so769438a12.3; Fri, 19 Apr 2024 00:53:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713513187; x=1714117987; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dkg2PsPWwQuUQlT1wRqaFRT1C3anmOX1PDdZQuQBq4k=; b=VX5Xg5RfSMuZk+rVZS8oi4KmxS1dpTGUgIltPyYUWU4NrVty/QwaPqczM/XLHLDHTp yljF2RCytpZw5IjKLmY40h+/Yl+1Xn/L0MlTO44H2g/SL9D3jNNKhmRi4WYARgzaSz8H Kz0VCTaU5WQVwU1baTc186avUxZ0S22MWgB/nNDu9AF+c7taVIMzMCt0ycV0Vo+4Y9yg 4AZqpbR0a9jPS3fAyXLPgVMPnS953NbHKdZ5sGQq3VKRaMcAL2VxldgDfj5n2s1ikUcD 9R/8xShn9uymRHQBRVhK7xCzcuidW886FUf98069n2Ve88TCdO8ixCFO/AYLcVXGl+9y p7vA== X-Forwarded-Encrypted: i=1; AJvYcCXiGg0lcqZ5a8J8y0kGjhSy8iA4PtiZo+hVsl1T4ATaNoSEOa0w56xKLh+S5WeXdE9enkcA9uptmO/1Luvl3Ldq4k684UiX8N30A9ZCf0oo2OizXkkZJqCQ/7MWombTATIQRGo31I188InrgQ== X-Gm-Message-State: AOJu0Yy06X9m6TE+wALunlkTrjCvjQ0645JrksPrBT+XsfkmaOMziwV+ 0rzBoGSZDxiey9GqUE6aXi5P60EnO6OF2NATqDmB08N+O4hP6NGx X-Received: by 2002:a50:8e17:0:b0:56e:57f9:8c83 with SMTP id 23-20020a508e17000000b0056e57f98c83mr961424edw.19.1713513187398; Fri, 19 Apr 2024 00:53:07 -0700 (PDT) Received: from ?IPV6:2a0b:e7c0:0:107::aaaa:69? ([2a0b:e7c0:0:107::aaaa:69]) by smtp.gmail.com with ESMTPSA id e22-20020a50ec96000000b0056e2b351956sm1812134edr.22.2024.04.19.00.53.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 19 Apr 2024 00:53:07 -0700 (PDT) Message-ID: Date: Fri, 19 Apr 2024 09:53:06 +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() From: Jiri Slaby 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> <8947962f-e39e-4e96-9d1e-691e40d49349@kernel.org> Content-Language: en-US Autocrypt: addr=jirislaby@kernel.org; keydata= xsFNBE6S54YBEACzzjLwDUbU5elY4GTg/NdotjA0jyyJtYI86wdKraekbNE0bC4zV+ryvH4j rrcDwGs6tFVrAHvdHeIdI07s1iIx5R/ndcHwt4fvI8CL5PzPmn5J+h0WERR5rFprRh6axhOk rSD5CwQl19fm4AJCS6A9GJtOoiLpWn2/IbogPc71jQVrupZYYx51rAaHZ0D2KYK/uhfc6neJ i0WqPlbtIlIrpvWxckucNu6ZwXjFY0f3qIRg3Vqh5Q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bK+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: <8947962f-e39e-4e96-9d1e-691e40d49349@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 19. 04. 24, 9:43, Jiri Slaby wrote: > 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) Still wrong, ret = -EIO missing in here. > +               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