From patchwork Tue Jul 25 00:49:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 108599 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp4659475qge; Mon, 24 Jul 2017 17:49:19 -0700 (PDT) X-Received: by 10.99.175.67 with SMTP id s3mr18214674pgo.134.1500943759124; Mon, 24 Jul 2017 17:49:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500943759; cv=none; d=google.com; s=arc-20160816; b=wCxfVknPrBcPqJAOWml7Pxo1rBRxjeutyPnVne/Mvn5L/1UglBcwcYo9SCIt5HuoDq l7zzdEiMNdoMk4BuNI5kGi0Gdwnnqd7r5uNOKvh5zwFE2wTj/3hBasUI5vhslPz0Ham8 02Z8yzJypxD3atWEBQBTxs7RPa+O5DC+T5b53NhcaJeNLAwHT1iedV4p3zDmwq1rcg6z stbX3kAmos5GlYl9SSVW5qtgfTVljwjeRSAIgfs8XInKJZdAtyRGuGqyUdTpTyYf0amb JgCtz7YiA3fmyeNZ9QBn5R86SV29ABgBfB+y8BXaT/xCTctGYg6PVxmTAesHPfpFDQqY LRdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Fz30CZLjlsQUUVffDDNK+BEvYU6VxBikhOjNqyzcRJc=; b=JK0c+VPdzrRywIyx3VhevjdapSBz7hJVBIQcxXJS7QbF7jIVvOA4foTk5dlJD4x1yr VWuZAVvVpqiz9fVRaPuC/2jSe8zygSordNwqZcZbU872+6ohscy4Cl6UHrtpuAUDIdA2 3ShO2zbQZA2MsQlh9mN17xgCb5W4yQDLWyBetB6SB9isVcSg3DN+rgXOeWgnhqdorzZa yUZZD43W5ybMrvEkAz5gGkouvQgoe21EPurA0e2iwgOGBXKQrbVBMY97FNQGLG2zL6yu kNEqITcWy6LTZj8ob2lBhprrlmJXxtGiP3CYlF9J47iBQbAY34kdd+ITKkf1tePR4REX xvQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.b=NzmJVrPC; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 n6si6133064pgd.730.2017.07.24.17.49.18; Mon, 24 Jul 2017 17:49:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.b=NzmJVrPC; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754079AbdGYAtQ (ORCPT + 6 others); Mon, 24 Jul 2017 20:49:16 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:33868 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751869AbdGYAtO (ORCPT ); Mon, 24 Jul 2017 20:49:14 -0400 Received: by mail-pg0-f66.google.com with SMTP id v190so13085217pgv.1 for ; Mon, 24 Jul 2017 17:49:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=Fz30CZLjlsQUUVffDDNK+BEvYU6VxBikhOjNqyzcRJc=; b=NzmJVrPCRNixq1B4wwZVEU82Y2CNssXetAQ1OmZEYTAzjW+mGXl2/E20blf3SZ11xz PlDhDD9EKPfOYxBsytbMdqjNWAJGrdrHo6nc57RDFAQ+DZgB9nHVydtYIRdVlrAxR7qf 85N6tJcvamr2mxRRV+TfmpD8gcgaFBlDL9HQWRq7oiI+Ev9AOwWDI/eoT/YxSjFp9E1r zQi3aAwlnA6fMjZoSeLFOq5ulvIkxL4iX1TTpVUAP33kpLB5pIkrX+3TYFNWjPvHDN3F +MSlo1naLfV+RN996v1Aw2RRQ0/e++9x15hXd8t6CxP4j5WaUzIe90BONSZgca1stSD8 1Cjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=Fz30CZLjlsQUUVffDDNK+BEvYU6VxBikhOjNqyzcRJc=; b=nhiAPoyfXMeezGZWB4XcJkQh44OfinjFxtsv5JyDSZmGGSelVrN9mh0CxnI4qwARcX RtsYzAqSQ9iiXLLBK6zFBiCs2TWNZABKxwcTwStAfA7hrz8OUTLRtAQgv6slsWdD77vf 51ieiAUzwUYl59So6NaynuhSDAd8w+iY4aQ8UZulwG4x08TQwm+bQC9a0tFLDHV5eye1 35NHVK9qpg0wyNkt5eIuyFJKiBDs2VA1+DxX1D8RsFq1v5Q6C6HBpV9QRHqA+/U1fnp1 SH0LLxGy7zYdonN4l3RA3h2tLEFbjNg7KGXPz1EVwyQnflHx57NlshPl1H4s4Sm0eHYw Qcwg== X-Gm-Message-State: AIVw110rqvUc+8DQ4oNbxo5/yHR0fa316LD9p2k+TrhN68fbtGU5G7Z5 66VDV8VM9TIJYw== X-Received: by 10.84.137.169 with SMTP id 38mr19321297pln.331.1500943753449; Mon, 24 Jul 2017 17:49:13 -0700 (PDT) Received: from aurora.jms.id.au ([45.124.203.15]) by smtp.gmail.com with ESMTPSA id o186sm21585224pfo.155.2017.07.24.17.49.10 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 24 Jul 2017 17:49:12 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Tue, 25 Jul 2017 10:19:06 +0930 From: Joel Stanley To: "David S . Miller" Cc: Benjamin Herrenschmidt , netdev@vger.kernel.org Subject: [PATCH] ftgmac100: return error in ftgmac100_alloc_rx_buf Date: Tue, 25 Jul 2017 10:19:01 +0930 Message-Id: <20170725004901.13406-1-joel@jms.id.au> X-Mailer: git-send-email 2.13.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The error paths set err, but it's not returned. I wondered if we should fix all of the callers to check the returned value, but Ben explains why the code is this way: > Most call sites ignore it on purpose. There's nothing we can do if > we fail to get a buffer at interrupt time, so we point the buffer to > the scratch page so the HW doesn't DMA into lalaland and lose the > packet. > > The one call site that tests and can fail is the one used when brining > the interface up. If we fail to allocate at that point, we fail the > ifup. But as you noticed, I do have a bug not returning the error. Acked-by: Benjamin Herrenschmidt Signed-off-by: Joel Stanley --- drivers/net/ethernet/faraday/ftgmac100.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.13.3 diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index fce0aa4f78b7..33b5c8eb9961 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -392,7 +392,7 @@ static int ftgmac100_alloc_rx_buf(struct ftgmac100 *priv, unsigned int entry, struct net_device *netdev = priv->netdev; struct sk_buff *skb; dma_addr_t map; - int err; + int err = 0; skb = netdev_alloc_skb_ip_align(netdev, RX_BUF_SIZE); if (unlikely(!skb)) { @@ -428,7 +428,7 @@ static int ftgmac100_alloc_rx_buf(struct ftgmac100 *priv, unsigned int entry, else rxdes->rxdes0 = 0; - return 0; + return err; } static unsigned int ftgmac100_next_rx_pointer(struct ftgmac100 *priv,