Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1246934pxv; Fri, 16 Jul 2021 05:13:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKb/ui2uThJ1/H+OSkKbXm2h98ArD8SRV1GI4JbBCja+UxQrnvvyIJr/W9rBN8EIZJnmI6 X-Received: by 2002:aa7:de90:: with SMTP id j16mr14280563edv.385.1626437609089; Fri, 16 Jul 2021 05:13:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626437609; cv=none; d=google.com; s=arc-20160816; b=nNgRszt5gufu1DtTRtbKYPhX7UfhP6LJ3dCeG8ZnO3Ix5XE01XeD3H4fz3OfKgHA2p W5/0Znaj+SPollh70OCHVkcOvmfPEqAIk4zqhhsNbKfy8fS2VmNVucvkfbGoYZZ/SUv+ PEs29UsKWN4V0zEr3JkwvffFfWjyrBg3r6NhOSy/fa/WFT3dtcpLGtUqDgRm851/gpm3 BRlzeQhG9udYVH9HByzWWCJ09d2/qb1XUyGeADAcbAROSQ7fhRwuPJ5PdXsGsWb/6htz hhhldl3erg88/fwLcGbJgLXgb3TIezIqK85P/awZYRQG5TwSkJx+6B7SVBvVO2GL/dob nmlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=wVe2SjiT0+M14c2J4Tg0eegyrJnAR5cGT6rLsSr3Bq4=; b=FXL5wSuXUQazt/hhiHC7sobP4UEoop1c9uDMO/tsTaesyoUItg/4WlJW7yjQLzTLVg GjI0jdj+w2Qvl+x4kn3CHG093k+R51t15E0sXNBgTqrcDXM1Oedh4aMLiHDtphddG+6A h2cwXap3XElb7YfG7yRzi15GdoEJKqTttQMPFMhEtHYGQ2MMVISpfb1MVM7hrhqvZCrw inWBAsasHnZuJIyeyNbmPRfY6jtsTiLAMwv6XJNv1CKkXptMTQ2ZUY0Ni6heAyDq5J7P Y4Je7YW1uiFdzmJzb6L1u813ewRsTJTYtMxR0cgZSTokMR/sF3qpdiz7+2oIjCXvQSwL sJYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dy16si10566936edb.359.2021.07.16.05.13.04; Fri, 16 Jul 2021 05:13:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232810AbhGPMOj (ORCPT + 99 others); Fri, 16 Jul 2021 08:14:39 -0400 Received: from foss.arm.com ([217.140.110.172]:38236 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232024AbhGPMOi (ORCPT ); Fri, 16 Jul 2021 08:14:38 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 03A52D6E; Fri, 16 Jul 2021 05:11:43 -0700 (PDT) Received: from [10.57.36.240] (unknown [10.57.36.240]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C7A2A3F774; Fri, 16 Jul 2021 05:11:39 -0700 (PDT) Subject: Re: [PATCH v1 14/16] x86/amd_gart: return error code from gart_map_sg() To: Christoph Hellwig , Logan Gunthorpe Cc: linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, iommu@lists.linux-foundation.org, linux-parisc@vger.kernel.org, xen-devel@lists.xenproject.org, Marek Szyprowski , Stephen Bates , Martin Oliveira , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Niklas Schnelle , Thomas Bogendoerfer , Michael Ellerman References: <20210715164544.6827-1-logang@deltatee.com> <20210715164544.6827-15-logang@deltatee.com> <20210716063241.GC13345@lst.de> From: Robin Murphy Message-ID: <98c09e65-35d0-dde5-75fc-e3d99864d078@arm.com> Date: Fri, 16 Jul 2021 13:11:33 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210716063241.GC13345@lst.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-07-16 07:32, Christoph Hellwig wrote: > On Thu, Jul 15, 2021 at 10:45:42AM -0600, Logan Gunthorpe wrote: >> @@ -458,7 +460,7 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, >> iommu_full(dev, pages << PAGE_SHIFT, dir); >> for_each_sg(sg, s, nents, i) >> s->dma_address = DMA_MAPPING_ERROR; >> - return 0; >> + return ret; > > While we're at it - setting the ->dma_address to DMA_MAPPING_ERROR is > not part of the ->map_sg calling convention. Might be worth to fix > up while we're at it. Especially since it's not even zeroing dma_length, which at least is a documented indicator of validity (even if it's not strictly defined for failure cases either). Robin.