* [PATCH net-next] yellowfin: fix remove set but not used variable warning
@ 2019-02-18 8:15 YueHaibing
2019-02-18 20:13 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: YueHaibing @ 2019-02-18 8:15 UTC (permalink / raw)
To: David S . Miller, Yang Wei; +Cc: YueHaibing, netdev, kernel-janitors
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/net/ethernet/packetengines/yellowfin.c: In function 'yellowfin_rx':
drivers/net/ethernet/packetengines/yellowfin.c:1053:18: warning:
variable 'yf_size' set but not used [-Wunused-but-set-variable]
This puts the variable declaration into the YF_PROTOTYPE macro.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/ethernet/packetengines/yellowfin.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/packetengines/yellowfin.c b/drivers/net/ethernet/packetengines/yellowfin.c
index 6f8d6584f809..edc8cc7f0d0d 100644
--- a/drivers/net/ethernet/packetengines/yellowfin.c
+++ b/drivers/net/ethernet/packetengines/yellowfin.c
@@ -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
if(!desc->result_status)
break;
@@ -1068,8 +1071,6 @@ static int yellowfin_rx(struct net_device *dev)
if (--boguscnt < 0)
break;
- yf_size = sizeof(struct yellowfin_desc);
-
if ( ! (desc_status & RX_EOP)) {
if (data_size != 0)
netdev_warn(dev, "Oversized Ethernet frame spanned multiple buffers, status %04x, data_size %d!\n",
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] yellowfin: fix remove set but not used variable warning
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
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2019-02-18 20:13 UTC (permalink / raw)
To: yuehaibing; +Cc: yang.wei9, netdev, kernel-janitors
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);
!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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] yellowfin: fix remove set but not used variable warning
2019-02-18 20:13 ` David Miller
@ 2019-02-19 2:34 ` YueHaibing
0 siblings, 0 replies; 3+ messages in thread
From: YueHaibing @ 2019-02-19 2:34 UTC (permalink / raw)
To: David Miller; +Cc: yang.wei9, netdev, kernel-janitors
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.
>
> .
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-19 2:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).