Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1579711pxk; Thu, 10 Sep 2020 20:59:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8yXHnzbLIZHiF3aaPwMVhNjo0UUxo9kNvsFsDte4A9/fMmLLC4nl1NGNgnTAJsfTvmuFo X-Received: by 2002:a17:906:1c4f:: with SMTP id l15mr155890ejg.419.1599796785910; Thu, 10 Sep 2020 20:59:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599796785; cv=none; d=google.com; s=arc-20160816; b=HyFDIFTqZHu1HYOt3X/VeKUMMgEbPG0HrNTctJ9QawKgwDL8g2W30/lboWScavTgw/ ZuXht064Jk3IVgFKhViIj7IBgiTFLvVJiRqLIvcuk0Le0Rrsyw46aXBS0MTRc3hIRWs0 iR0TgG8bWvvF4/2YDfLUFv0amHorU9/y98iijnb0UDWWtdKKCqugtPekX1z2xFUv11np nR62NqjnIe540hJTNCueduRX8ce5P5XJutZcBukoKVccW/ctyRYcXERxv8Vc2MSpm4JS EnxKBpYYJcwLdgt3vhCnSCFjsMCsqTwN7Ztx6yUkihKI00Y2hMmzFAVlZsoGklmoyT2a kXXw== 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 :message-id:date:subject:cc:to:from; bh=ny1c0GVjrJ2pfL7V+Qw7qtH/g8j6WZEHwwU3in8miDk=; b=u7Zv9QtdNWf3BuC3TcLTGyGMYl1zKXS9X+sHgGxCDyVMD7Vy6F5rZM1itqzXEA3KQb akkA1f6GgZQE2WRwQnXRbX6FmTtYYi8bjvxIM8ZQ7b3Ge+PxgjRLltfvcv8BR+xqfbgI PukBv0zfS+PwhA4rvLTVr1vxT2rSzkttK/ffNIKcuqj1Nb5CdyggXg86INo9XntMLifw BPAGRsszNaPUqGrAKkckVzrOXhfYGaJgDo2gky4A321tHSCl4Af6BcbmMRDKn344OFUV Jz/zrKJZnLe7IP6LfQ/aZvcM7/NwAIkrU8Gw6K7TRVqbdlQQkLrFeT2WXvKBFXEKyaEH yQ1g== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q26si479401eji.610.2020.09.10.20.59.23; Thu, 10 Sep 2020 20:59:45 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725773AbgIKD6b (ORCPT + 99 others); Thu, 10 Sep 2020 23:58:31 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:11811 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725283AbgIKD6Z (ORCPT ); Thu, 10 Sep 2020 23:58:25 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 98578750294870E6A356; Fri, 11 Sep 2020 11:58:23 +0800 (CST) Received: from huawei.com (10.69.192.56) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Fri, 11 Sep 2020 11:58:17 +0800 From: Luo Jiaxing To: , , , , , CC: , , Subject: [PATCH net-next] net: stmmac: set get_rx_header_len() as void for it didn't have any error code to return Date: Fri, 11 Sep 2020 11:55:58 +0800 Message-ID: <1599796558-45818-1-git-send-email-luojiaxing@huawei.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We found the following warning when using W=1 to build kernel: drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3634:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable] int ret, coe = priv->hw->rx_csum; When digging stmmac_get_rx_header_len(), dwmac4_get_rx_header_len() and dwxgmac2_get_rx_header_len() return 0 only, without any error code to report. Therefore, it's better to define get_rx_header_len() as void. Signed-off-by: Luo Jiaxing --- drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 3 +-- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 3 +-- drivers/net/ethernet/stmicro/stmmac/hwif.h | 4 ++-- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c index eff8206..c6540b0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c @@ -494,10 +494,9 @@ static void dwmac4_set_vlan(struct dma_desc *p, u32 type) p->des2 |= cpu_to_le32(type & TDES2_VLAN_TAG_MASK); } -static int dwmac4_get_rx_header_len(struct dma_desc *p, unsigned int *len) +static void dwmac4_get_rx_header_len(struct dma_desc *p, unsigned int *len) { *len = le32_to_cpu(p->des2) & RDES2_HL; - return 0; } static void dwmac4_set_sec_addr(struct dma_desc *p, dma_addr_t addr) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c index c3d654c..0aaf19a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c @@ -286,11 +286,10 @@ static int dwxgmac2_get_rx_hash(struct dma_desc *p, u32 *hash, return -EINVAL; } -static int dwxgmac2_get_rx_header_len(struct dma_desc *p, unsigned int *len) +static void dwxgmac2_get_rx_header_len(struct dma_desc *p, unsigned int *len) { if (le32_to_cpu(p->des3) & XGMAC_RDES3_L34T) *len = le32_to_cpu(p->des2) & XGMAC_RDES2_HL; - return 0; } static void dwxgmac2_set_sec_addr(struct dma_desc *p, dma_addr_t addr) diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index ffe2d63..e2dca9b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -90,7 +90,7 @@ struct stmmac_desc_ops { /* RSS */ int (*get_rx_hash)(struct dma_desc *p, u32 *hash, enum pkt_hash_types *type); - int (*get_rx_header_len)(struct dma_desc *p, unsigned int *len); + void (*get_rx_header_len)(struct dma_desc *p, unsigned int *len); void (*set_sec_addr)(struct dma_desc *p, dma_addr_t addr); void (*set_sarc)(struct dma_desc *p, u32 sarc_type); void (*set_vlan_tag)(struct dma_desc *p, u16 tag, u16 inner_tag, @@ -150,7 +150,7 @@ struct stmmac_desc_ops { #define stmmac_get_rx_hash(__priv, __args...) \ stmmac_do_callback(__priv, desc, get_rx_hash, __args) #define stmmac_get_rx_header_len(__priv, __args...) \ - stmmac_do_callback(__priv, desc, get_rx_header_len, __args) + stmmac_do_void_callback(__priv, desc, get_rx_header_len, __args) #define stmmac_set_desc_sec_addr(__priv, __args...) \ stmmac_do_void_callback(__priv, desc, set_sec_addr, __args) #define stmmac_set_desc_sarc(__priv, __args...) \ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 89b2b34..7e95412 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3631,15 +3631,15 @@ static unsigned int stmmac_rx_buf1_len(struct stmmac_priv *priv, struct dma_desc *p, int status, unsigned int len) { - int ret, coe = priv->hw->rx_csum; unsigned int plen = 0, hlen = 0; + int coe = priv->hw->rx_csum; /* Not first descriptor, buffer is always zero */ if (priv->sph && len) return 0; /* First descriptor, get split header length */ - ret = stmmac_get_rx_header_len(priv, p, &hlen); + stmmac_get_rx_header_len(priv, p, &hlen); if (priv->sph && hlen) { priv->xstats.rx_split_hdr_pkt_n++; return hlen; -- 2.7.4