Fixes 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 by default. Therefore, ret do not
need to check the error value and can be directly deleted.
Signed-off-by: Luo Jiaxing <[email protected]>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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
On Thu, 10 Sep 2020 10:42:45 +0800 Luo Jiaxing wrote:
> Fixes 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 by default. Therefore, ret do not
> need to check the error value and can be directly deleted.
>
> Signed-off-by: Luo Jiaxing <[email protected]>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> 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);
This function should return void if there never are any errors to
report.
> if (priv->sph && hlen) {
> priv->xstats.rx_split_hdr_pkt_n++;
> return hlen;
On 2020/9/11 3:29, Jakub Kicinski wrote:
> On Thu, 10 Sep 2020 10:42:45 +0800 Luo Jiaxing wrote:
>> Fixes 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 by default. Therefore, ret do not
>> need to check the error value and can be directly deleted.
>>
>> Signed-off-by: Luo Jiaxing <[email protected]>
>> ---
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> 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);
> This function should return void if there never are any errors to
> report.
Yes, you are right. So, if we need to modify the function type , this
patch need to be drop.
And I will send a new patch later to redefine get_rx_header_len() to
void and delete ret there.
Please check "net: stmmac: set get_rx_header_len() as void for it didn't
have any error code to return" later.
Thanks
Jiaxing
>> if (priv->sph && hlen) {
>> priv->xstats.rx_split_hdr_pkt_n++;
>> return hlen;
>
> .
>