linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] qlcnic: remove set but not used variables 'cur_rings, max_hw_rings, tx_desc_info'
@ 2018-11-28 12:29 YueHaibing
  2018-11-28 12:37 ` Shaikh, Shahed
  2018-11-28 19:10 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: YueHaibing @ 2018-11-28 12:29 UTC (permalink / raw)
  To: davem, Shahed.Shaikh, manish.chopra, Dept-GELinuxNICDev
  Cc: linux-kernel, netdev, YueHaibing

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c:4011:5:
 warning: variable 'max_hw_rings' set but not used [-Wunused-but-set-variable]
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c:4013:6:
 warning: variable 'cur_rings' set but not used [-Wunused-but-set-variable]
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c:2996:25:
 warning: variable 'tx_desc_info' set but not used [-Wunused-but-set-variable]

'cur_rings, max_hw_rings' never used since introduction in commit
34e8c406fda5 ("qlcnic: refactor Tx/SDS ring calculation and validation in driver.")
'tx_desc_info' never used since commit
95b3890ae39f ("qlcnic: Enhance Tx timeout debugging.")
Also 'queue_type' only can be QLCNIC_RX_QUEUE/QLCNIC_TX_QUEUE,
so make a trival cleanup on if statement.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index d42ba22..16d0479 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -2993,10 +2993,8 @@ int qlcnic_check_temp(struct qlcnic_adapter *adapter)
 static inline void dump_tx_ring_desc(struct qlcnic_host_tx_ring *tx_ring)
 {
 	int i;
-	struct cmd_desc_type0 *tx_desc_info;
 
 	for (i = 0; i < tx_ring->num_desc; i++) {
-		tx_desc_info = &tx_ring->desc_head[i];
 		pr_info("TX Desc: %d\n", i);
 		print_hex_dump(KERN_INFO, "TX: ", DUMP_PREFIX_OFFSET, 16, 1,
 			       &tx_ring->desc_head[i],
@@ -4008,19 +4006,12 @@ int qlcnic_validate_rings(struct qlcnic_adapter *adapter, __u32 ring_cnt,
 			  int queue_type)
 {
 	struct net_device *netdev = adapter->netdev;
-	u8 max_hw_rings = 0;
 	char buf[8];
-	int cur_rings;
 
-	if (queue_type == QLCNIC_RX_QUEUE) {
-		max_hw_rings = adapter->max_sds_rings;
-		cur_rings = adapter->drv_sds_rings;
+	if (queue_type == QLCNIC_RX_QUEUE)
 		strcpy(buf, "SDS");
-	} else if (queue_type == QLCNIC_TX_QUEUE) {
-		max_hw_rings = adapter->max_tx_rings;
-		cur_rings = adapter->drv_tx_rings;
+	else
 		strcpy(buf, "Tx");
-	}
 
 	if (!is_power_of_2(ring_cnt)) {
 		netdev_err(netdev, "%s rings value should be a power of 2\n",
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH net-next] qlcnic: remove set but not used variables 'cur_rings, max_hw_rings, tx_desc_info'
  2018-11-28 12:29 [PATCH net-next] qlcnic: remove set but not used variables 'cur_rings, max_hw_rings, tx_desc_info' YueHaibing
@ 2018-11-28 12:37 ` Shaikh, Shahed
  2018-11-28 19:10 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Shaikh, Shahed @ 2018-11-28 12:37 UTC (permalink / raw)
  To: YueHaibing, davem, Chopra, Manish, Dept-GE Linux NIC Dev
  Cc: linux-kernel, netdev

> -----Original Message-----
> From: YueHaibing <yuehaibing@huawei.com>
> Sent: Wednesday, November 28, 2018 6:00 PM
> To: davem@davemloft.net; Shaikh, Shahed <Shahed.Shaikh@cavium.com>;
> Chopra, Manish <Manish.Chopra@cavium.com>; Dept-GE Linux NIC Dev
> <Dept-GELinuxNICDev@cavium.com>
> Cc: linux-kernel@vger.kernel.org; netdev@vger.kernel.org; YueHaibing
> <yuehaibing@huawei.com>
> Subject: [PATCH net-next] qlcnic: remove set but not used variables
> 'cur_rings, max_hw_rings, tx_desc_info'
> 
> 
> Fixes gcc '-Wunused-but-set-variable' warning:
> 
> drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c:4011:5:
>  warning: variable 'max_hw_rings' set but not used [-Wunused-but-set-
> variable]
> drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c:4013:6:
>  warning: variable 'cur_rings' set but not used [-Wunused-but-set-variable]
> drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c:2996:25:
>  warning: variable 'tx_desc_info' set but not used [-Wunused-but-set-
> variable]
> 
> 'cur_rings, max_hw_rings' never used since introduction in commit
> 34e8c406fda5 ("qlcnic: refactor Tx/SDS ring calculation and validation in
> driver.")
> 'tx_desc_info' never used since commit
> 95b3890ae39f ("qlcnic: Enhance Tx timeout debugging.")
> Also 'queue_type' only can be QLCNIC_RX_QUEUE/QLCNIC_TX_QUEUE,
> so make a trival cleanup on if statement.
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 13 ++-----------
>  1 file changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> index d42ba22..16d0479 100644
> --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> @@ -2993,10 +2993,8 @@ int qlcnic_check_temp(struct qlcnic_adapter
> *adapter)
>  static inline void dump_tx_ring_desc(struct qlcnic_host_tx_ring *tx_ring)
>  {
>         int i;
> -       struct cmd_desc_type0 *tx_desc_info;
> 
>         for (i = 0; i < tx_ring->num_desc; i++) {
> -               tx_desc_info = &tx_ring->desc_head[i];
>                 pr_info("TX Desc: %d\n", i);
>                 print_hex_dump(KERN_INFO, "TX: ", DUMP_PREFIX_OFFSET, 16, 1,
>                                &tx_ring->desc_head[i],
> @@ -4008,19 +4006,12 @@ int qlcnic_validate_rings(struct qlcnic_adapter
> *adapter, __u32 ring_cnt,
>                           int queue_type)
>  {
>         struct net_device *netdev = adapter->netdev;
> -       u8 max_hw_rings = 0;
>         char buf[8];
> -       int cur_rings;
> 
> -       if (queue_type == QLCNIC_RX_QUEUE) {
> -               max_hw_rings = adapter->max_sds_rings;
> -               cur_rings = adapter->drv_sds_rings;
> +       if (queue_type == QLCNIC_RX_QUEUE)
>                 strcpy(buf, "SDS");
> -       } else if (queue_type == QLCNIC_TX_QUEUE) {
> -               max_hw_rings = adapter->max_tx_rings;
> -               cur_rings = adapter->drv_tx_rings;
> +       else
>                 strcpy(buf, "Tx");
> -       }
> 
>         if (!is_power_of_2(ring_cnt)) {
>                 netdev_err(netdev, "%s rings value should be a power of 2\n",
> --
> 2.7.0
> 

Looks good.

Acked-by: Shahed Shaikh <shahed.shaikh@cavium.com>

Thanks,
Shahed

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] qlcnic: remove set but not used variables 'cur_rings, max_hw_rings, tx_desc_info'
  2018-11-28 12:29 [PATCH net-next] qlcnic: remove set but not used variables 'cur_rings, max_hw_rings, tx_desc_info' YueHaibing
  2018-11-28 12:37 ` Shaikh, Shahed
@ 2018-11-28 19:10 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-11-28 19:10 UTC (permalink / raw)
  To: yuehaibing
  Cc: Shahed.Shaikh, manish.chopra, Dept-GELinuxNICDev, linux-kernel, netdev

From: YueHaibing <yuehaibing@huawei.com>
Date: Wed, 28 Nov 2018 20:29:39 +0800

> Fixes gcc '-Wunused-but-set-variable' warning:
> 
> drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c:4011:5:
>  warning: variable 'max_hw_rings' set but not used [-Wunused-but-set-variable]
> drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c:4013:6:
>  warning: variable 'cur_rings' set but not used [-Wunused-but-set-variable]
> drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c:2996:25:
>  warning: variable 'tx_desc_info' set but not used [-Wunused-but-set-variable]
> 
> 'cur_rings, max_hw_rings' never used since introduction in commit
> 34e8c406fda5 ("qlcnic: refactor Tx/SDS ring calculation and validation in driver.")
> 'tx_desc_info' never used since commit
> 95b3890ae39f ("qlcnic: Enhance Tx timeout debugging.")
> Also 'queue_type' only can be QLCNIC_RX_QUEUE/QLCNIC_TX_QUEUE,
> so make a trival cleanup on if statement.
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-28 19:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-28 12:29 [PATCH net-next] qlcnic: remove set but not used variables 'cur_rings, max_hw_rings, tx_desc_info' YueHaibing
2018-11-28 12:37 ` Shaikh, Shahed
2018-11-28 19:10 ` David Miller

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).