Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6385494pxv; Thu, 29 Jul 2021 13:17:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhmIom5euRUChapUQqVUEW/DylCbRtA4ohG5vVdye2MvP+iCzdHW1glIqD+pV8GhKVjgxY X-Received: by 2002:a05:6638:1356:: with SMTP id u22mr5940133jad.39.1627589859214; Thu, 29 Jul 2021 13:17:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627589859; cv=none; d=google.com; s=arc-20160816; b=cq5oWPtOKQBqqwm7axY+EHJLK0NLGcwkhpgSQr37iEHAY119fEojy2tGZ259O1p9xx O0sX7ADeE9FBnZ6yM4C/HmOGRShe053R0W9M0oFLDcGnwW98E/x2jwo3+UcAtTWVDRNT boIH97Xj6r4GA+RA72V2hcKwJsr8gF9d5Ibh+dqsUIF0xqfQivKOfqhlDnAHFFuqGVsq AitTa4m9HLbkOeaKrZIUHs7L8rqzqDQ0h/XD2xDR9mm7QtHb43S8SSi24jqbqfyKiJHj +x1rmsL309qz1dV+ngY3tXQBcbM7hlQ6qnL/SsJ0DDNgn6rrq+wvkzf3CCh2hhAGnNma cXJA== 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=wMwfB+QVxoWPoNbugW7oseZQ2FEaT6sisUumX/+txWI=; b=C6DPqbSKL9ArquQRmcWSAugYszBWzly1Hop58mXivsVzVQDYDAhCP0lR2IDl/r75t4 VIiPC7wXXgXwRzuu+SNxO4HxgBQEBfpVBfbj19dGDWqV9A0mS1JWMqUBxomuhhrB9XgR 7WioJ7Zf0R8OGXc8vJorFtwfIcfaQ4jwraT09Xt8B71C4yQ7tSsHKExE+DsNAd0i4NWv TYeKfqia/Vvi+qN+RR7LQuCTJKstOx7uKzFaCfWJKQYRfgI6g4L6TM+ADSMh5S51evCB hwhI6bqJDlWJoznrUjWfTOKqOMxPdI5MzeebxEBHPe4cl7d2lDvJQTEC/OMvVonbvx/f 7ttA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b="ID/pq4C2"; 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 q23si4772983jav.118.2021.07.29.13.17.26; Thu, 29 Jul 2021 13:17:39 -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="ID/pq4C2"; 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 S232996AbhG2UQq (ORCPT + 99 others); Thu, 29 Jul 2021 16:16:46 -0400 Received: from ale.deltatee.com ([204.191.154.188]:59270 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232950AbhG2UQD (ORCPT ); Thu, 29 Jul 2021 16:16:03 -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=wMwfB+QVxoWPoNbugW7oseZQ2FEaT6sisUumX/+txWI=; b=ID/pq4C2aTQp2oDNVLghKs/nGq /MY9zdoBCMMHh3c6T8MI3nnmvuQUSVCPLIfeepLGK/XGDLYHuElnVIv6Ocren27qwsmRloi4lA+k2 jUcV8AabILTLu9D+RA2F7MkSwG5Ubtk18ez7B6ZLKOLIi15PTQt0AW//JuASu5bJBrfxoubREfwb4 rkH6cVX/Fb8WXCP7sWran6zWw0+yy0j3rZnkl5dse4GfPUQvjKpOJdAzSOnscdDZg/XYmOpir/Dz+ rl+LrmmUPA5AvuG0H48DCHNFEeG+t1CHY5QhUZBIg4JK21d2e2IZnjFfVArCF81YGjKAKWB52iX16 QcWfwO7g==; 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 1m9CRf-0008VO-Uv; Thu, 29 Jul 2021 14:15:56 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1m9CRV-0001Tz-5J; Thu, 29 Jul 2021 14:15:45 -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 , Niklas Schnelle , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Christian Borntraeger Date: Thu, 29 Jul 2021 14:15:30 -0600 Message-Id: <20210729201539.5602-13-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210729201539.5602-1-logang@deltatee.com> References: <20210729201539.5602-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, schnelle@linux.ibm.com, gerald.schaefer@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, borntraeger@de.ibm.com 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 v3 12/21] s390/pci: return error code from s390_dma_map_sg() 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. So propagate the error from __s390_dma_map_sg() up. __s390_dma_map_sg() returns either -ENOMEM on allocation failure or -EINVAL which is the same as what's expected by dma_map_sgtable(). Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Acked-by: Niklas Schnelle Cc: Gerald Schaefer Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Christian Borntraeger --- arch/s390/pci/pci_dma.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c index ebc9a49523aa..c78b02012764 100644 --- a/arch/s390/pci/pci_dma.c +++ b/arch/s390/pci/pci_dma.c @@ -487,7 +487,7 @@ static int s390_dma_map_sg(struct device *dev, struct scatterlist *sg, unsigned int max = dma_get_max_seg_size(dev); unsigned int size = s->offset + s->length; unsigned int offset = s->offset; - int count = 0, i; + int count = 0, i, ret; for (i = 1; i < nr_elements; i++) { s = sg_next(s); @@ -497,8 +497,9 @@ static int s390_dma_map_sg(struct device *dev, struct scatterlist *sg, if (s->offset || (size & ~PAGE_MASK) || size + s->length > max) { - if (__s390_dma_map_sg(dev, start, size, - &dma->dma_address, dir)) + ret = __s390_dma_map_sg(dev, start, size, + &dma->dma_address, dir); + if (ret) goto unmap; dma->dma_address += offset; @@ -511,7 +512,8 @@ static int s390_dma_map_sg(struct device *dev, struct scatterlist *sg, } size += s->length; } - if (__s390_dma_map_sg(dev, start, size, &dma->dma_address, dir)) + ret = __s390_dma_map_sg(dev, start, size, &dma->dma_address, dir); + if (ret) goto unmap; dma->dma_address += offset; @@ -523,7 +525,7 @@ static int s390_dma_map_sg(struct device *dev, struct scatterlist *sg, s390_dma_unmap_pages(dev, sg_dma_address(s), sg_dma_len(s), dir, attrs); - return 0; + return ret; } static void s390_dma_unmap_sg(struct device *dev, struct scatterlist *sg, -- 2.20.1