* [PATCH] mlxsw: spectrum: remove redundant check if err is zero
@ 2016-09-23 11:02 Colin King
2016-09-23 12:14 ` Jiri Pirko
2016-09-24 12:28 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2016-09-23 11:02 UTC (permalink / raw)
To: Jiri Pirko, Ido Schimmel, netdev; +Cc: linux-kernel
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mlxsw: spectrum: remove redundant check if err is zero
2016-09-23 11:02 [PATCH] mlxsw: spectrum: remove redundant check if err is zero Colin King
@ 2016-09-23 12:14 ` Jiri Pirko
2016-09-24 12:28 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2016-09-23 12:14 UTC (permalink / raw)
To: Colin King; +Cc: Jiri Pirko, Ido Schimmel, netdev, linux-kernel
Fri, Sep 23, 2016 at 01:02:45PM CEST, colin.king@canonical.com wrote:
>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>
Acked-by: Jiri Pirko <jiri@mellanox.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mlxsw: spectrum: remove redundant check if err is zero
2016-09-23 11:02 [PATCH] mlxsw: spectrum: remove redundant check if err is zero Colin King
2016-09-23 12:14 ` Jiri Pirko
@ 2016-09-24 12:28 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-09-24 12:28 UTC (permalink / raw)
To: colin.king; +Cc: jiri, idosch, netdev, linux-kernel
From: Colin King <colin.king@canonical.com>
Date: Fri, 23 Sep 2016 12:02:45 +0100
> 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>
Applied to net-next.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-24 12:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-23 11:02 [PATCH] mlxsw: spectrum: remove redundant check if err is zero Colin King
2016-09-23 12:14 ` Jiri Pirko
2016-09-24 12:28 ` 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).