Netdev List
 help / color / mirror / Atom feed
From: YueHaibing <yuehaibing@huawei.com>
To: David Miller <davem@davemloft.net>
Cc: <yang.wei9@zte.com.cn>, <netdev@vger.kernel.org>,
	<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH net-next] yellowfin: fix remove set but not used variable warning
Date: Tue, 19 Feb 2019 10:34:04 +0800	[thread overview]
Message-ID: <6a7fe3d5-9532-c1fb-764a-2e12f98ee914@huawei.com> (raw)
In-Reply-To: <20190218.121337.147896114474592034.davem@davemloft.net>

On 2019/2/19 4:13, David Miller wrote:
> From: YueHaibing <yuehaibing@huawei.com>
> Date: Mon, 18 Feb 2019 08:15:46 +0000
> 
>> @@ -1050,8 +1050,11 @@ static int yellowfin_rx(struct net_device *dev)
>>  		struct sk_buff *rx_skb = yp->rx_skbuff[entry];
>>  		s16 frame_status;
>>  		u16 desc_status;
>> -		int data_size, yf_size;
>> +		int data_size;
>>  		u8 *buf_addr;
>> +#ifdef YF_PROTOTYPE
>> +		int yf_size = sizeof(struct yellowfin_desc);
>> +#endif
> 
> This is just silly.
> 
> Please move this variable declaration and initialization into the
> YF_PROTOTYPE basic block in the code below it, like this:
> 
> #ifdef YF_PROTOTYPE		/* Support for prototype hardware errata. */
> 		} else if ((yp->flags & HasMACAddrBug)  &&
> 			int yf_size = sizeof(struct yellowfin_desc);

There's just in if condition, define the 'yf_size' seems incorrect

maybe we can remove 'yf_size' and use sizeof directly?

> 
> 			!ether_addr_equal(le32_to_cpu(yp->rx_ring_dma +
> 						      entry * yf_size),
> 					  dev->dev_addr) &&
> 			!ether_addr_equal(le32_to_cpu(yp->rx_ring_dma +
> 						      entry * yf_size),
> 					  "\377\377\377\377\377\377")) {
> 			if (bogus_rx++ == 0)
> 				netdev_warn(dev, "Bad frame to %pM\n",
> 					    buf_addr);
> #endif
> 
> Thanks.
> 
> .
> 


      reply	other threads:[~2019-02-19  2:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-18  8:15 [PATCH net-next] yellowfin: fix remove set but not used variable warning YueHaibing
2019-02-18 20:13 ` David Miller
2019-02-19  2:34   ` YueHaibing [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a7fe3d5-9532-c1fb-764a-2e12f98ee914@huawei.com \
    --to=yuehaibing@huawei.com \
    --cc=davem@davemloft.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yang.wei9@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox