Commit 31f2760e authored by Luo Jiaxing's avatar Luo Jiaxing Committed by David S. Miller

net: stmmac: set get_rx_header_len() as void for it didn't have any error code to return

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: default avatarLuo Jiaxing <luojiaxing@huawei.com>
Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5bc461fd
...@@ -494,10 +494,9 @@ static void dwmac4_set_vlan(struct dma_desc *p, u32 type) ...@@ -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); 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; *len = le32_to_cpu(p->des2) & RDES2_HL;
return 0;
} }
static void dwmac4_set_sec_addr(struct dma_desc *p, dma_addr_t addr) static void dwmac4_set_sec_addr(struct dma_desc *p, dma_addr_t addr)
......
...@@ -286,11 +286,10 @@ static int dwxgmac2_get_rx_hash(struct dma_desc *p, u32 *hash, ...@@ -286,11 +286,10 @@ static int dwxgmac2_get_rx_hash(struct dma_desc *p, u32 *hash,
return -EINVAL; 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) if (le32_to_cpu(p->des3) & XGMAC_RDES3_L34T)
*len = le32_to_cpu(p->des2) & XGMAC_RDES2_HL; *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) static void dwxgmac2_set_sec_addr(struct dma_desc *p, dma_addr_t addr)
......
...@@ -90,7 +90,7 @@ struct stmmac_desc_ops { ...@@ -90,7 +90,7 @@ struct stmmac_desc_ops {
/* RSS */ /* RSS */
int (*get_rx_hash)(struct dma_desc *p, u32 *hash, int (*get_rx_hash)(struct dma_desc *p, u32 *hash,
enum pkt_hash_types *type); 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_sec_addr)(struct dma_desc *p, dma_addr_t addr);
void (*set_sarc)(struct dma_desc *p, u32 sarc_type); void (*set_sarc)(struct dma_desc *p, u32 sarc_type);
void (*set_vlan_tag)(struct dma_desc *p, u16 tag, u16 inner_tag, void (*set_vlan_tag)(struct dma_desc *p, u16 tag, u16 inner_tag,
...@@ -150,7 +150,7 @@ struct stmmac_desc_ops { ...@@ -150,7 +150,7 @@ struct stmmac_desc_ops {
#define stmmac_get_rx_hash(__priv, __args...) \ #define stmmac_get_rx_hash(__priv, __args...) \
stmmac_do_callback(__priv, desc, get_rx_hash, __args) stmmac_do_callback(__priv, desc, get_rx_hash, __args)
#define stmmac_get_rx_header_len(__priv, __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...) \ #define stmmac_set_desc_sec_addr(__priv, __args...) \
stmmac_do_void_callback(__priv, desc, set_sec_addr, __args) stmmac_do_void_callback(__priv, desc, set_sec_addr, __args)
#define stmmac_set_desc_sarc(__priv, __args...) \ #define stmmac_set_desc_sarc(__priv, __args...) \
......
...@@ -3630,15 +3630,15 @@ static unsigned int stmmac_rx_buf1_len(struct stmmac_priv *priv, ...@@ -3630,15 +3630,15 @@ static unsigned int stmmac_rx_buf1_len(struct stmmac_priv *priv,
struct dma_desc *p, struct dma_desc *p,
int status, unsigned int len) int status, unsigned int len)
{ {
int ret, coe = priv->hw->rx_csum;
unsigned int plen = 0, hlen = 0; unsigned int plen = 0, hlen = 0;
int coe = priv->hw->rx_csum;
/* Not first descriptor, buffer is always zero */ /* Not first descriptor, buffer is always zero */
if (priv->sph && len) if (priv->sph && len)
return 0; return 0;
/* First descriptor, get split header length */ /* 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) { if (priv->sph && hlen) {
priv->xstats.rx_split_hdr_pkt_n++; priv->xstats.rx_split_hdr_pkt_n++;
return hlen; return hlen;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment