Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1489947

[PATCH] mlxsw: spectrum: remove redundant check if err is zero

From Colin King <colin.king@canonical.com>
Newsgroups linux.kernel
Subject [PATCH] mlxsw: spectrum: remove redundant check if err is zero
Date 2016-09-23 13:10 +0200
Message-ID <skwwF-2RT-13@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


From: Colin Ian King <colin.king@canonical.com>

There is an earlier check and return if err is non-zero, so
the check to see if it is zero is redundant in every iteration
of the loop and hence the check can be removed.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 80f27b5..fd74d10 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -1664,7 +1664,7 @@ static void __mlxsw_sp_port_get_stats(struct net_device *dev,
 		return;
 	mlxsw_sp_port_get_stats_raw(dev, grp, prio, ppcnt_pl);
 	for (i = 0; i < len; i++)
-		data[data_index + i] = !err ? hw_stats[i].getter(ppcnt_pl) : 0;
+		data[data_index + i] = hw_stats[i].getter(ppcnt_pl);
 }
 
 static void mlxsw_sp_port_get_stats(struct net_device *dev,
-- 
2.9.3

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] mlxsw: spectrum: remove redundant check if err is zero Colin King <colin.king@canonical.com> - 2016-09-23 13:10 +0200
  Re: [PATCH] mlxsw: spectrum: remove redundant check if err is zero Jiri Pirko <jiri@resnulli.us> - 2016-09-23 14:20 +0200
  Re: [PATCH] mlxsw: spectrum: remove redundant check if err is zero David Miller <davem@davemloft.net> - 2016-09-24 14:30 +0200

csiph-web