Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp565550pxv; Thu, 15 Jul 2021 10:21:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjOxZoL3j2oAgaSXkXY8lgebSLeDlnwZnbfB2yCRG/O8WLAuN5mzivdZq70Vpy2DwoRK06 X-Received: by 2002:a05:6402:1a38:: with SMTP id be24mr8494839edb.58.1626369701221; Thu, 15 Jul 2021 10:21:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626369701; cv=none; d=google.com; s=arc-20160816; b=GOO18d3pzMwZH5gAZY3alDf5DTxKl2FxKl+b/LpY4NO9usdhhMFyzdbDfsJNokWMKg P43FX3whNGqwryfPvOkzILSPTz6ILezo5g54sq7xo9JdcmSn6lTR2+aBMZfuPEe0XPKW VutWi+oMBAAwUeKH5TBsP/5EoTnxzb8ETxA44QT7VAplTha8/x9rbpSKBn85sqP8op/R c2xbfWK/9ZRvKj1fXWNha3iqHgER8Sb8TPz7v5SLkHBYUvRJm9bZxrzfuAAWrtuEKtLt o+LjhnDzucrshE0Gy/2De1TQpSpql2kib0ZQUovmWj57QROYC6l5lETUAaZ+2O4e7hSe gYUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=yHZJDyrbtc2DNRkkLnCWk6LyCavHBAROxZPaBwPJV+w=; b=dLDb8b9hVL3OXfQDBQ//bDzNNM4mwAqhNOvteKF/XGcdypMDdAoAKwKZ6XP+9wWTod /EOvjQvcw5dbSTXfIt9J8LM623MXJ6BbIGHuhFdARm9bW0M+VrLooKT2kVp8F7pmFz+6 zlvECi6UmCoAQ+SdpLJ2cIduCE+K+Sdj6JAiERIZt82YmzzMBsiFhgZWxWK6hr0PA1by lAxSGwEw62/TRCjdH57ub8ERz/lQZzw8Sjiwt6Pg1MpM6fG/Tgq/t9eEtwzR8+fYSybJ MIGD/g4a+f4yK6VscHRWFXqKWxrewIaNqm8E/fQ503oVpBUE3w64ZG7CoBBsnSN/bHzw tRrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=Uk9hmVlO; 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=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d10si7864261ejr.696.2021.07.15.10.21.17; Thu, 15 Jul 2021 10:21:41 -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; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=Uk9hmVlO; 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=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235700AbhGOQtf (ORCPT + 99 others); Thu, 15 Jul 2021 12:49:35 -0400 Received: from ale.deltatee.com ([204.191.154.188]:50144 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234206AbhGOQtI (ORCPT ); Thu, 15 Jul 2021 12:49:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:MIME-Version:References:In-Reply-To: Message-Id:Date:Cc:To:From:content-disposition; bh=yHZJDyrbtc2DNRkkLnCWk6LyCavHBAROxZPaBwPJV+w=; b=Uk9hmVlOMLTaHT5Tplw3GW15jH CeVS5nCeJY2tUo3aAcbZduCSQVDn0jptjFbmtnj3v5G8CraUuCNv7B/bA1lXnwAqLJwQNB2t23QL6 GCZqhLMOwzqRH34G+Y5BBzb4NQhwdrGK5mOkNWXt9gAGnvdQqFYRscmaU6pWKWcE7qUt7wO4D80pe 8/PNToWYD9qaWrwbmxJrGUcHjdK3p3BXVy4naPhfKpzb1aURkg8IXCH/NXXzv+OOVY95aZoB5qwfA QHHlGEKoZAnVNvL5MsmbOBHtpgrk0NyNnIEds8LB/+w6+0+ZS1RCVbWjm8vff/8qi0kFo6Sr+2pOL bwtGjm0w==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m44V0-0001ye-IS; Thu, 15 Jul 2021 10:46:11 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1m44Uo-0001nQ-Dh; Thu, 15 Jul 2021 10:45:58 -0600 From: Logan Gunthorpe To: 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 Cc: Christoph Hellwig , Marek Szyprowski , Robin Murphy , Stephen Bates , Martin Oliveira , Logan Gunthorpe , Michael Ellerman , Niklas Schnelle , Thomas Bogendoerfer Date: Thu, 15 Jul 2021 10:45:35 -0600 Message-Id: <20210715164544.6827-8-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210715164544.6827-1-logang@deltatee.com> References: <20210715164544.6827-1-logang@deltatee.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@vger.kernel.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-parisc@vger.kernel.org, xen-devel@lists.xenproject.org, hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com, sbates@raithlin.com, martin.oliveira@eideticom.com, logang@deltatee.com, mpe@ellerman.id.au, schnelle@linux.ibm.com, tsbogend@alpha.franken.de X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, MYRULES_NO_TEXT autolearn=no autolearn_force=no version=3.4.2 Subject: [PATCH v1 07/16] ia64/sba_iommu: return error code from sba_map_sg_attrs() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Oliveira The .map_sg() op now expects an error code instead of zero on failure. Propagate the return of dma_mapping_error() up, if it is an errno. sba_coalesce_chunks() may only presently fail if sba_alloc_range() fails, which in turn only fails if the iommu is out of mapping resources, hence a -ENOMEM is used in that case. Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: Michael Ellerman Cc: Niklas Schnelle Cc: Thomas Bogendoerfer --- arch/ia64/hp/common/sba_iommu.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c index 9148ddbf02e5..09dbe07a18c1 100644 --- a/arch/ia64/hp/common/sba_iommu.c +++ b/arch/ia64/hp/common/sba_iommu.c @@ -1431,7 +1431,7 @@ static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist, unsigned long attrs) { struct ioc *ioc; - int coalesced, filled = 0; + int coalesced, filled = 0, ret; #ifdef ASSERT_PDIR_SANITY unsigned long flags; #endif @@ -1458,8 +1458,9 @@ static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist, sglist->dma_length = sglist->length; sglist->dma_address = sba_map_page(dev, sg_page(sglist), sglist->offset, sglist->length, dir, attrs); - if (dma_mapping_error(dev, sglist->dma_address)) - return 0; + ret = dma_mapping_error(dev, sglist->dma_address); + if (ret) + return ret; return 1; } @@ -1486,7 +1487,7 @@ static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist, coalesced = sba_coalesce_chunks(ioc, dev, sglist, nents); if (coalesced < 0) { sba_unmap_sg_attrs(dev, sglist, nents, dir, attrs); - return 0; + return -ENOMEM; } /* -- 2.20.1