Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2498845imm; Mon, 24 Sep 2018 05:30:43 -0700 (PDT) X-Google-Smtp-Source: ACcGV60Jr2oilGEmgiDufv3+/wa9noBKp6pT7hAj7+b7zuZO2r7bQHw7IJEeW1CUK7ROmucXAta6 X-Received: by 2002:a17:902:74c7:: with SMTP id f7-v6mr10351041plt.45.1537792243608; Mon, 24 Sep 2018 05:30:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537792243; cv=none; d=google.com; s=arc-20160816; b=VOaotRk1OgupoxmCkFr+GsAOFm5UG0RC96cZOzV2idGIUw4KuBqvV/InhJ/sH9Rb+9 T9FMMHMYn58Jhr//RqN0nO3fpKPR6oEjN0sNX0GQVWvctRS3WcUAKP8HLomzarU3Dkba bj/ptfguRBsnc0LWtnx2IdyyoWQF1rsggk1mXOVZ/UOKJx4BlVSLwdd/dsTuUVBx/p20 w2mVb0PlS3YcOQ/JZDRQSKmPSEv2RbihERyyMdKuBeKqgZAWXFk4rBbv+h1CGHR7Dsz3 w6xSMDo6heDm7ZZyDmGwgAnygcTRM4UCoxA3U6EwOtX2Jm3QhuNrox2paqUKgqRd6Yfg opjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=iZ4532aM3uRiV1JghIbkoqiNLQBoZrOxGYiggAEvUxk=; b=ov/GSA5TxA9I4yZNtniVtJoSa/A51gI/jTbss8gdw4vtrgsG76Nw1OhVnRnqm+ee1+ R27jZVWirDAYSvdlP/xLH1UkTZoXljlB9aTtbJzfKxZlqB0ZdiUl3P/v9VbrV6mkHHak 2wfSo6546KnJ/RuhTVyCbnTN+iqaEK5CiedxxCslUnVmicdI6JPo76uSaA8/dVUyLkVT FLci8VULnioF96w7MNjt+0tsfTv9u8UDJlH3RsmRZPfm7ysTbaxp9fjU/06B8/xV5Wx7 VWYw6BgZlsYddbcPUUKI/1RE6FCtRinGH0S7nrMQI8XJrDtLGsDewH+955ECdvsHsbxT Qkwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si13844357plx.140.2018.09.24.05.30.27; Mon, 24 Sep 2018 05:30:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387449AbeIXS3v (ORCPT + 99 others); Mon, 24 Sep 2018 14:29:51 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57364 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730233AbeIXS3u (ORCPT ); Mon, 24 Sep 2018 14:29:50 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5970D1018; Mon, 24 Sep 2018 12:27:56 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , "David S. Miller" , Sasha Levin Subject: [PATCH 4.18 024/235] amd-xgbe: use dma_mapping_error to check map errors Date: Mon, 24 Sep 2018 13:50:10 +0200 Message-Id: <20180924113107.117393431@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: YueHaibing [ Upstream commit b24dbfe9ce03d9f83306616f22fb0e04e8960abe ] The dma_mapping_error() returns true or false, but we want to return -ENOMEM if there was an error. Fixes: 174fd2597b0b ("amd-xgbe: Implement split header receive support") Signed-off-by: YueHaibing Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/amd/xgbe/xgbe-desc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/drivers/net/ethernet/amd/xgbe/xgbe-desc.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-desc.c @@ -289,7 +289,7 @@ static int xgbe_alloc_pages(struct xgbe_ struct page *pages = NULL; dma_addr_t pages_dma; gfp_t gfp; - int order, ret; + int order; again: order = alloc_order; @@ -316,10 +316,9 @@ again: /* Map the pages */ pages_dma = dma_map_page(pdata->dev, pages, 0, PAGE_SIZE << order, DMA_FROM_DEVICE); - ret = dma_mapping_error(pdata->dev, pages_dma); - if (ret) { + if (dma_mapping_error(pdata->dev, pages_dma)) { put_page(pages); - return ret; + return -ENOMEM; } pa->pages = pages;